Up Down Counter Using Arduino

29,404

50

6

Introduction: Up Down Counter Using Arduino

About: Technology enthusiastic, crazy about embedded system, love Arduino and raspberry pi.

Hello Ardu-man!

Today I am going to make a UP/DOWN counter using Arduino.

Step 1: Things That Are Required

1) Arduino Uno (any board)

2) Breadboard

3) 2x1k ohm resistor

4) 2x push switch

5) 1x 10k potentiometer

6) 1x 16x2 lcd

7) Jumper wires

Step 2: Circuit Diagram

Step 3: Code

//UP DOWN Counter.

#include <LiquidCrystal.h>

LiquidCrystal lcd(12,11,5,4,3,2);

int A;

int B;

int t;

int ctr=0;

void setup()

{

lcd.begin(16,2);

lcd.print("UP DOWN Counter");

delay(2000);

}

void loop()

{

A = analogRead(A0);

B = analogRead(A1);

t = 300;

if(A < t && B > t)

{

ctr = ctr + 1;

delay(900);

}

else

{

ctr = ctr;

}

if(A > t && B < t)

{

ctr = ctr -1;

delay(900);

}

else

{

ctr = ctr;

}

lcd.setCursor(0,0);

lcd.print("Counter : ");

lcd.setCursor(10,0);

lcd.print(ctr);

delay(100);

lcd.clear();

}

1 Person Made This Project!

Recommendations

  • Make it Glow Contest

    Make it Glow Contest
  • First Time Author Contest

    First Time Author Contest
  • PCB Challenge

    PCB Challenge

6 Discussions

0
Medtech082013
Medtech082013

Question 3 months ago on Step 3

Hi Awesome project i am using a 16x1 so the last 8 digits are missing how do i change to use a 16x1, sorry i am a noob,

0
pmason9028
pmason9028

Question 8 months ago on Step 3

Hi, could you please tell me if I can set it to not go below zero and no higher than 4?
much appreciated
phil

0
rhorne5
rhorne5

3 years ago

How easy would it be to modify this so that when the counter hits a certain number it triggers a micro switch?

0
Adil95
Adil95

Reply 3 years ago

Very easy.

Just add a "if" statement.

0
Oujidon123
Oujidon123

4 years ago

I've been needing a 7 segment arduino up down counter that goes from 0 to 9, can anyne help?