Hi,
at the moment i've created a small application to log data from the arduino and send it to a log file using linux
The code(messy) looks like this
int a [3] = {0,0,0};
int b [3] = {0,0,0};
int c [3] = {0,0,0};
int p0, p1, p2, time = 0;
void setup()
{
Serial.begin(1200);
}
void loop()
{
a[1] = analogRead(0);
b[1] = analogRead(1);
c[1] = analogRead(2);
delay(10);
a[2] = analogRead(0);
b[2] = analogRead(1);
c[2] = analogRead(2);
delay(10);
a[3] = analogRead(0);
b[3] = analogRead(1);
c[3] = analogRead(2);
p0 = (a[1]+a[2]+a[3])/3;
p1 = (b[1]+b[2]+b[3])/3;
p2 = (b[1]+b[2]+b[3])/3;
time = millis()/1000;
Serial.print(time);
Serial.print(",");
Serial.print(p0);
Serial.print(",");
Serial.print(p1);
Serial.print(",");
Serial.print(p2);
Serial.print("\n");
delay(980);
}
However, if i use the Arduino IDE, value time (function milli()) is reset each time i go to use the serial monitor. If i use a bash command such as
cat /dev/ttyUSB0
value time has not been reset.
Do i have to echo something to my Arduino for milli to reset?
Cheers