Go Down

Topic: Simple button counter that increments by 5 (Read 1 time) previous topic - next topic


The code works as i want it to, but the code is probably full of wrong code and i will clean it up when the project is complete:)


I'll explain what you have.

This will show 5 when the button is pressed. NOTE it will not start at 0, even when declaired "int Counter = 0;" the reason your Serial.println().
Code: [Select]
if (CurrentSwitch == LOW)
        Serial.println(Counter); // <= This is the reason you see 5 instead of 0 because it is inside the same IF statement, however if you move
                                       // Serial.println(Counter); outside the IF statement it will start at 0, but it will show continious numbers.

My GitHub:

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131