Arduino Lcd Counter

42,516

13

8

Introduction: Arduino Lcd Counter

build a simple arduino lcd counter using simple components such as push buttons and LCD

Step 1: 1

build a simple arduino lcd counter using simple components such as push buttons and LCD

The parts list

Arduino Uno

16x2 LCD

Push Buttons

Potentiometer 100k

10k Resistor

220R Resistor

Breadboard

Connecting Wires

Step 2: Circuit

Step 3: Code

Be the First to Share

    Recommendations

    • Battery Powered Contest

      Battery Powered Contest
    • Plywood Challenge

      Plywood Challenge
    • Plastic Contest

      Plastic Contest

    8 Discussions

    0
    DcpR
    DcpR

    Question 11 months ago on Step 1

    Dear sir,
    Arduno LCD programming is without pressing any key counting is increasing
    Please help me

    0
    SujanP2
    SujanP2

    Answer 10 months ago

    button pin should connected with resister of 1k with ground and another vcc to p
    pushbutton

    0
    SujanP2
    SujanP2

    Question 10 months ago

    i want to add EEPROM to hold the counter
    And one more push button to reset the counter and erase the value of eeprom

    0
    rLAsugar666
    rLAsugar666

    3 years ago

    How would you edit this to make it count down as well

    0
    mauro.malatesta
    mauro.malatesta

    Reply 1 year ago

    Check my reply above, you can ignore the AND logic inside the loop:

    if (buttonState == HIGH) {
    // if the current state is HIGH then the button went from off to on:

    It will increase whenever state changes

    0
    AissaniA
    AissaniA

    2 years ago

    hello,

    that was nice except for the fact , if you press the button for a long time it will continuously counting up every 200mS, without releasing the button and pressing again, any idea to fix that please? i want it to stop counting unless the button is released and pressed again what ever is the pressing time is,

    thankyou in advance

    1
    mauro.malatesta
    mauro.malatesta

    Reply 1 year ago

    Hello, I don't know if you managed to solve this issue, but you can use a State Change detection. I've have modified the code available at: https://www.arduino.cc/en/Tutorial/StateChangeDetection

    Here's mine:

    int buttonPushCounter = 0; // counter for the number of button presses
    int buttonState = 0; // current state of the button
    int lastButtonState = 0; // previous state of the button
    const int buttonPin = 7; // the pin that the pushbutton is attached to


    void loop() {
    // read the pushbutton input pin:
    buttonState = digitalRead(buttonPin);
    // compare the buttonState to its previous state
    if (buttonState != lastButtonState) {
    // if the state has changed, increment the counter
    if (buttonState == HIGH) {
    // if the current state is HIGH then the button went from off to on:
    buttonPushCounter++;
    }
    // Delay a little bit to avoid bouncing
    delay(50);
    lcd.setCursor(3, 1);
    lcd.print(buttonPushCounter);
    }
    // save the current state as the last state, for next time through the loop
    lastButtonState = buttonState;
    }

    0
    DennisPropellerHead
    DennisPropellerHead

    3 years ago

    Can you help me expand this idea a bit? I want to build a punch counter for my son's martial arts club. It will count the number of hits to a punching board (bag) in 45 seconds.

    Ideally, what I envision is a reset button, triggering a set of warning beeps......

    beep, beep, beeeeeeeeeeeeeep, a small counting display 1-45 seconds and a much larger display for the count (3 digits would suffice) followed by a long beep and stop and freeze the count until the next reset.

    Although it might be possible to trigger it with a switch, I think an accelerometer might be the way to go.

    I have all the parts to build, but I am a complete beginner on the programming side and I could use some help. I want to learn this stuff, but I need this project sooner than later. ;-)

    Any offers to help greatly appreciated!

    Best Regards, Dennis