bwenox:
BulldogLowell, could you please explain what did oyu meant by that?
I meant it quite literally:
void loop()
{
unsigned long currentTime = micros(); //only read micros() once
if (n < 200)
{
if (currentTime - ttimee >= 1000)
{
voltage = analogRead(A0);
table[n] = voltage;
//timee[n] = currentTime / 1000; // instead of this
timee[n] = micros(); // try this
n++;
ttimee = currentTime;
}
}
else if (!finish)
{
finish = true;
analogWrite(9, 0);
for (n = 0; n < 200; n++)
{
Serial.print(timee[n]);
Serial.print("\t");
Serial.println(table[n]);
}
}
}