hey i'm trying to do a code that counts 1 if the sensor is HIGH, but i've been trying and its going like 1,2,3,100, 200...
I want to ++1 just once in a value. Here is my try..
int valor=0;
void setup() {
Serial.begin(9600);
pinMode(3, INPUT_PULLUP);
}
void loop() {
int sensorVal = digitalRead(3);
if (sensorVal==1){
valor ++;
Serial.println(valor);
}
}