I think the lower bound for Serial.available() might be 0 --> https://docs.particle.io/reference/firmware/electron/#available-
I usually use while(!Serial.available()
Something minimal to test:
int counter = 20;
void setup(){
counter = -10;
Serial.begin(9600);
}
void loop(){
if(Serial.available()){ //hit any button
Serial.read();
Serial.println(counter);
}
}
Update: oh yeah it should be all lowercase setup() ![]()