[...]
String string = "";
int lastSample = 0;
[...]
void loop()
{
[...]
if (millis() - lastSample >= 50) // We can't be overloading our computers serial buffer now can we?
{
Serial.println(string);
lastSample = millis();
}
[...]
}
I believe that lastSample should be unsigned long.
Regards,
Brad
KF7FER