loading

In this project we will make a seven segment that counts the number from 0 to 9 and every number will be shown for one second and then the next number will be shown and when it reaches 9 it will reset

Things you will need :

  1. common cathode seven segment
  2. wires
  3. bread board
  4. 220 ohm resistor
  5. arduino uno

Step 1: Data Sheet

this project was made using the data sheet shown in the picture

Step 2: Connections

Now connect the parts like shown in picture

we wont be using the H pin on seven segment
connect the common or middle pins together and connect one of them to the resistor and connect the resistor to the ground or GND

connections are like this :

the right side are arduino pins and the left side are seven segments pins

pin a = pin 1 arduino

pin b = pin 2 arduino

pin c = pin 3 arduino

pin d = pin 4 arduino

pin e = pin 5 arduino

pin f = pin 6 arduino

pin g = pin 7 arduino

Step 3: Code

Now copy the code below to your programmer or arduino IDE

/*
Seven segment counter makes your seven segment count from 0 to 9 every 1 second Created by: Mohsen Nasiri visit our site: www.fountainofthoughts.net */

int a = 1; int b = 2; int c = 3; int d = 4; int e = 5; int f = 6; int g = 7; void setup () { pinMode(1,OUTPUT); pinMode(2,OUTPUT); pinMode(3,OUTPUT); pinMode(4,OUTPUT); pinMode(5,OUTPUT); pinMode(6,OUTPUT); pinMode(7,OUTPUT); } void loop () { digitalWrite(a,HIGH); digitalWrite(b,HIGH); digitalWrite(c,HIGH); digitalWrite(d,HIGH); digitalWrite(f,HIGH); digitalWrite(e,HIGH); delay(1000); digitalWrite(a,LOW); digitalWrite(b,LOW); digitalWrite(c,LOW); digitalWrite(d,LOW); digitalWrite(f,LOW); digitalWrite(e,LOW); digitalWrite(b,HIGH); digitalWrite(c,HIGH); delay(1000); digitalWrite(b,LOW); digitalWrite(c,LOW); digitalWrite(a,HIGH); digitalWrite(b,HIGH); digitalWrite(g,HIGH); digitalWrite(e,HIGH); digitalWrite(d,HIGH); delay(1000); digitalWrite(a,LOW); digitalWrite(b,LOW); digitalWrite(g,LOW); digitalWrite(e,LOW); digitalWrite(d,LOW); digitalWrite(a,HIGH); digitalWrite(b,HIGH); digitalWrite(g,HIGH); digitalWrite(c,HIGH); digitalWrite(d,HIGH); delay(1000); digitalWrite(a,LOW); digitalWrite(b,LOW); digitalWrite(g,LOW); digitalWrite(c,LOW); digitalWrite(d,LOW); digitalWrite(f,HIGH); digitalWrite(g,HIGH); digitalWrite(b,HIGH); digitalWrite(c,HIGH); delay(1000); digitalWrite(f,LOW); digitalWrite(g,LOW); digitalWrite(b,LOW); digitalWrite(c,LOW); digitalWrite(a,HIGH); digitalWrite(f,HIGH); digitalWrite(g,HIGH); digitalWrite(c,HIGH); digitalWrite(d,HIGH); delay(1000); digitalWrite(a,LOW); digitalWrite(f,LOW); digitalWrite(g,LOW); digitalWrite(c,LOW); digitalWrite(d,LOW); digitalWrite(a,HIGH); digitalWrite(f,HIGH); digitalWrite(g,HIGH); digitalWrite(c,HIGH); digitalWrite(d,HIGH); digitalWrite(e,HIGH); delay(1000); digitalWrite(a,LOW); digitalWrite(f,LOW); digitalWrite(g,LOW); digitalWrite(c,LOW); digitalWrite(d,LOW); digitalWrite(e,LOW); digitalWrite(a,HIGH); digitalWrite(b,HIGH); digitalWrite(c,HIGH); delay(1000); digitalWrite(a,LOW); digitalWrite(b,LOW); digitalWrite(c,LOW); digitalWrite(a,HIGH); digitalWrite(b,HIGH); digitalWrite(c,HIGH); digitalWrite(d,HIGH); digitalWrite(e,HIGH); digitalWrite(f,HIGH); digitalWrite(g,HIGH); delay(1000); digitalWrite(a,LOW); digitalWrite(b,LOW); digitalWrite(c,LOW); digitalWrite(d,LOW); digitalWrite(e,LOW); digitalWrite(f,LOW); digitalWrite(g,LOW); digitalWrite(a,HIGH); digitalWrite(b,HIGH); digitalWrite(c,HIGH); digitalWrite(d,HIGH); digitalWrite(f,HIGH); digitalWrite(g,HIGH); delay(1000); digitalWrite(a,LOW); digitalWrite(b,LOW); digitalWrite(c,LOW); digitalWrite(d,LOW); digitalWrite(f,LOW); digitalWrite(g,LOW); delay(1000); }

About This Instructable

224views

9favorites

License:

More by Mohsenna124:Seven segment with arduino Arduino Traffic Light Tutorial 
Add instructable to: