Hi everyone.
I have to monitor an analog signal using arduino Galileo, but i'm still waiting for it to be delivered, so I tried to use arduino 1 to acquire the signal, using the analog digital converter (adc).
The sketch i wrote is the following:
#define N 400
int a[N];
int tempo[N];
int val = 0;
int i = 0;
int j = 0;
int counter = 0;
int button = 7;
int start = 0;
void setup()
{
pinMode(button, INPUT);
for (i= 0; i<N; i++)
{a[i] = 0;
tempo[i] = 0;
}
Serial.begin(9600);
}
void loop()
{
start = digitalRead(button);
delay(1000);
if (start == HIGH)
{
for(i=0; i<N; i++)
{a[i] = analogRead(A0);
tempo[i] = millis();
}
for(j=0; j<N; j++)
{
Serial.print(tempo[j]);
Serial.print(' ');
Serial.println(a[j]);
}
delay(5000);
}
else
{delay(2000);}
}
I found that arduino 1 acquire with this script at a frequency of 9,1kHz (Which is great to me!).
The number of sample N is limited by the SRAM of the Arduino, so if i use the millis function to monitor the time, the maximum number of sample that i can acquire is about 425.
However i found in the help that there is the possibility to write data (or informations) in the EEPROM memory. I know that if i have to write and to store data there the sampling frequency will decrease, but i would like to try... Maybe it will be accettable to me!
I read that i have to use the PROGMEM command, but it was really hard to me to understand how does it work.
So the question is the following:
how can I write an array (or more) on the EEPROM memory?
Thank you very much.
Moderator edit:
</mark> <mark>[code]</mark> <mark>
</mark> <mark>[/code]</mark> <mark>
tags added.