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

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!

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.

}

Comments

author
The creator sid (author)2017-01-20

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.

author
The creator sid (author)2017-01-20

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.

author
The creator sid (author)2017-01-18

No doubts!

author
Cr4ckz0ob (author)2017-01-18

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

About This Instructable

307views

9favorites

License:

Bio: I love electronics and Arduino.Stay creative!
More by The creator sid :Arduino(nano) Clap SwitchHow to make a 0-9 counter using an Arduino NanoHow to Make a Dark Sensor
Add instructable to: