Hi, I'm new with the forum but i have a question to ask:
I wrote this code for the arduino board:
'
#include <SD.h>
int pulsante = 5;
int marker = 4;
int minimo = 6;
int massimo = 14;
String data = "";
String markers ="";
int parametro,conteggio=0;
int dato,righe=3,i=2;
char name[] = "Test1.csv",dir[]= "Test1";
String s;
boolean premuto = true;
unsigned lun;
void setup()
{
pinMode(53, OUTPUT);
if (!SD.begin(4)) {
return;
}
while(SD.exists(dir))/
{
dir[4] = '';
s = dir;
s += i;
s.toCharArray(dir,s.length()+1);
i++;
}
i = 2;
if (!SD.mkdir(dir)){
return;
}
s = dir;
s += "/";
s += name;
s.toCharArray(name,s.length()+1);
s = dir;
lun = s.length();
}
void loop()
{
pinMode(pulsante,INPUT);
while(digitalRead(pulsante)==LOW){
;//null
}
for (int corrente =minimo; corrente<=massimo; corrente++)
pinMode(corrente, INPUT);//pone i pin dal n°6 al n°14 in lettura
while(SD.exists(name))
{
name[lun + 5] = '';
s = name;
s += i;
s += ".csv";
s.toCharArray(name,s.length()+1);
i++;
}
File lettura1 = SD.open(name, O_CREAT | O_APPEND | O_WRITE);
if (lettura1) { //se è stato possibile creare il file stampa del testo
lettura1.println("Nuova Sessione:");
lettura1.println("CH1");
lettura1.print("\t");
lettura1.print("CH2");
lettura1.print("\t");
lettura1.print("CH3");
lettura1.print("\t");
lettura1.print("CH4");
lettura1.print("\t");
lettura1.print("CH5");
lettura1.print("\t");
lettura1.print("CH6");
lettura1.print("\t");
lettura1.print("CH7");
lettura1.print("\t");
lettura1.print("CH8");
lettura1.print("\t");
}
while(digitalRead(pulsante)==HIGH){
parametro=analogRead(61);
dato=(parametro*500)/1023;
lettura1.println(parametro);
parametro=analogRead(62);
dato=(parametro*500)/1023;
lettura1.println(parametro);
parametro=analogRead(63);
dato=(parametro*500)/1023;
lettura1.println(parametro);
parametro=analogRead(64);
dato=(parametro*500)/1023;
lettura1.println(parametro);
parametro=analogRead(65);
dato=(parametro*500)/1023;
lettura1.println(parametro);
parametro=analogRead(66);
dato=(parametro*500)/1023;
lettura1.println(parametro);
parametro=analogRead(67);
dato=(parametro*500)/1023;
lettura1.println(parametro);
parametro=analogRead(68);
ato=(parametro*500)/1023;
lettura1.println(parametro);
lettura1.println();
if(premuto){
if(digitalRead(marker)==HIGH){
premuto = false;
}
}
else{
if(digitalRead(marker)==LOW)
premuto=true;
}
}
lettura1.close();
}
'
Basically it reads analog signals form 8 channels and prints the results on a csv file in a SD card with the Arduino SD shield,the thing is i can only get 516 Samples/sec with the best optimization i was able to obtain.
So now i was thinking about moving the code to the maple board but since it's an university project i need to be sure of the sampling rate i can obtain with the maple board befre actually buying it;So i would like to ask if someone could give my code a try(i understand only a few changes need to be made) and let me know how is the Sampling rate(possibly with a Serial monitor screenshot of the resoult of an inceasing variable after 10 seconds of execution),I hope someone can help me.
Thanks anyways