Hey guys,
Can you guys write the code for a scoreboard where every time you push a button it counts up one. If possible put comments next to it why you did it. Please make the code as easy as possible.
Thank you for all replies.
Hello CookieDoughMan
In the meantime, can you please stop all environmental risks, human rights violations and child abuse in the world? Sorry, but your project is not that difficult, that you need somebody to do your work completely. And of course not for free.
Anyway, we're glad to help, but we need you working (and learning) as well. So, what have you already tried? Where should the number be displayed?
Best
riesens
Thanks for the reply. I have programmed a traffic light, that's it. The number can be displayed anywhere, as long as you can press a button and the numerical light will increase by 1.
Thanks.
I actually meant "what have you already tried to get this specific project done?"
if(digitalRead(pushButtonPin) == LOW)
{
score = score + 1;
}
Serial.println(score);
There is a start. Use the internal pull up resistor for whatever pin you connect your button to.
This reads when the button is pressed, you may want to wait for a button release, or time delay etc.
Look at the Bounce.h library to read only 1 score per button press.