How to Make a 0-9 Counter Using an Arduino Nano

About: I love electronics and Arduino.Stay creative!

In this instructable,I will show you how to make a 0 to 9 counter using a seven segment display and an ArduinoNano

So,it's basically kind of interface with seven segment display

without wasting anytime...

Let's get started!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Order Your Components:

so the components required for this build are not much so it will be simple!

the components required are:

1xArduino Nano

1xSeven Segment Display

2x220 ohm resistors

some jumper wires and a breadboard.

Step 2: The Schematic:

Build this simple circuit!

Step 3: The Code:

void setup() {

pinMode (2,OUTPUT); //sets pin 2 in output mode

pinMode (3,OUTPUT); //sets pin 3 in output mode

pinMode (4,OUTPUT); //sets pin 4 in output mode

pinMode (5,OUTPUT); //sets pin 5 in output mode

pinMode (6,OUTPUT); //sets pin 6 in output mode

pinMode (8,OUTPUT); //sets pin 8 in output mode

pinMode (9,OUTPUT); //sets pin 9 in output mode

}

void loop()
{

//to turn on no. 1
digitalWrite (4,HIGH);

digitalWrite (3,HIGH);
delay(1000);

//to turn off no.1
digitalWrite (4,LOW);

digitalWrite (3,LOW);
delay(1000);

//to turn on no.2
digitalWrite (2,HIGH);

digitalWrite (9,HIGH);
digitalWrite (3,HIGH);

digitalWrite (5,HIGH);
digitalWrite (6,HIGH);

delay (1000);

//to turn off no.2
digitalWrite (2,LOW);

digitalWrite (9,LOW);
digitalWrite (3,LOW);

digitalWrite (5,LOW);
digitalWrite (6,LOW);

delay(1000);

//to turn on no.3
digitalWrite (3,HIGH);

digitalWrite (2,HIGH);
digitalWrite (9,HIGH);

digitalWrite (5,HIGH);
digitalWrite (4,HIGH);

delay(1000);

//to turn off no.3
digitalWrite (3,LOW);

digitalWrite (2,LOW);
digitalWrite (9,LOW);

digitalWrite (5,LOW);
digitalWrite (4,LOW);

delay (1000);

//to turn on no.4
digitalWrite (3,HIGH);

digitalWrite (8,HIGH);

digitalWrite(9,HIGH);

digitalWrite (4,HIGH);
delay(1000);

//to turn off no.4
digitalWrite (3,LOW);

digitalWrite (9,LOW);
digitalWrite (8,LOW);

digitalWrite (4,LOW);
delay(1000);

//to turn on no.5
digitalWrite (4,HIGH);

digitalWrite (2,HIGH);
digitalWrite (9,HIGH);

digitalWrite (5,HIGH);
digitalWrite (8,HIGH);

delay(1000);

//to turn off no.5
digitalWrite (4,LOW);

digitalWrite (2,LOW);
digitalWrite (9,LOW);

digitalWrite (5,LOW);
digitalWrite (8,LOW);

delay(1000);

//to turn on no.6
digitalWrite (4,HIGH);

digitalWrite (2,HIGH);
digitalWrite (9,HIGH);

digitalWrite (5,HIGH);
digitalWrite (8,HIGH);

digitalWrite (6,HIGH);
delay(1000);

//turn off no.6
digitalWrite (4,LOW);

digitalWrite (2,LOW);
digitalWrite (9,LOW);

digitalWrite (5,LOW);
digitalWrite (8,LOW);

digitalWrite (6,LOW);
delay(1000);

//to turn on no.7

digitalWrite (2,HIGH);

digitalWrite (3,HIGH);
digitalWrite (4,HIGH);

delay(1000);

//to turn off no.7
digitalWrite (2,LOW);

digitalWrite (3,LOW);
digitalWrite (4,LOW);

delay(1000);

//to turn on no.8
digitalWrite (2,HIGH);

digitalWrite (3,HIGH);
digitalWrite (4,HIGH);

digitalWrite (9,HIGH);
digitalWrite (5,HIGH);

digitalWrite (8,HIGH);
digitalWrite (6,HIGH);

delay(1000);

//to turn off no.8
digitalWrite (2,LOW);

digitalWrite (3,LOW);
digitalWrite (4,LOW);

digitalWrite (9,LOW);
digitalWrite (5,LOW);

digitalWrite (8,LOW);
digitalWrite (6,LOW);

delay(1000);

//to turn on no.9
digitalWrite (2,HIGH);

digitalWrite (3,HIGH);
digitalWrite (4,HIGH);

digitalWrite (9,HIGH);
digitalWrite (5,HIGH);

digitalWrite (8,HIGH);
delay(1000);

//to tun off no.9
digitalWrite (2,LOW);

digitalWrite (3,LOW);
digitalWrite (4,LOW);

digitalWrite (9,LOW);
digitalWrite (5,LOW);

digitalWrite (8,LOW);
delay(1000);

//Now,you should see the seven segment display displaying all the numbers from 1 to 9.

}

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    4 Discussions

    None
    The creator sid

    2 years ago

    I am very sad to say that I cannot upload instructables for some time cuz my Arduino nano got burned when I was working on my new project.

    None
    The creator sid

    2 years ago

    I am very sad to say that I cannot upload instructables for some time cuz my Arduino nano got burned when I was working on my new project.

    None
    Cr4ckz0ob

    2 years ago

    very practical! to make a rocket launcher with a counter side