Aurdino Project Free Download: LED Binary Counter

Aurdino Project  Free Download using LED :LED Binary Counter

In this post you can find the actual program coding for a Binary counter using LEDs. This is done using Aurdino. Hence it can be used for all Computer science, IT, Electrical engineering students to do their mini projects. You can also improve this further and do as a complete project.

Scope of the Project:

This is a simple project of demonstrating how a Binary counter works.

In this project we use 4 LEDs all either turns ON or turns OFF indicating the binary value of the decimal numbers. This starts counting from ‘0’ displaying one by one till it reaches  the binary value of ’15’.

Here we use only 4 LED pins. Hence we can display upto 15. You can use 8 pins to display till other higher values. We have certain time delay between each binary value that displays.

Algorithm :

  1. Get number from 0 to 15.
  2. It gets stored in their binary value. Hence no need of binary conversions.
  3. Using bitRead() function, checks the binary value of each number one by one. If it reads value 0, turn OFF that LED pin. If it reads 1, then turn ON that LED pin.
  4. Example, if it reads the binary value of  2 = 0010.  Using bitRead(), reads each bit from position 0 to 4 (in direction left to right).  Then the LED pins will turn ON for 1,  Turn OFF for 0:
LED pins position  Binary bit value
0 00
1 01
2 10
3 11

Similarly, each number is displayed through LED pins one by one in the increasing order from 0 to 15.

 Aurdino Project : LED Binary Counter Program coding Free Download

Working of the Project:

Step 1:

  • Create an array of 4  LED pins. i.e, LED_0 is connected to pin 2 of the microcontroller, LED_1 to pin 3 and so on.
  • In the array,  ledPins[0] equals 2,  ledPins[1] equals 3,  ledPins[2] equals 4,  ledPins[3] equals 5.

Step 2: void setup():

  • Set the LED pins of the array to the output mode one by one.
  • This is done using for loop.
  • Here we use only 4 pins. Hence check upto 4 pins in the condition of the for loop.

Step 3: void loop()

  • Here, we are going to display the binary number equivalent to decimal number from 0 to 3 using LED pins.
  • As each binary number have 2 digits from 00 to 11, we use 2 LED pins to show the binary values.
  • To show the binary values, we define a method binaryCounter().
  •  As our project, we are going to show the binary values counts from 00 (equals to 0) to 11 (equals to 3).
  • This counter increases by 1 continuously till it reaches 1111.
  • All this is done using for loop checking condition from 0 to 3. Here 0 represents 2 and  2(equals 3 in decimal).

Step 4: void showBinary()

  • Here the actual algorithm works. Using bitRead() function, we check each bit of the binary number and glows the LED pins based on that.
  • If it reads 1, LED glows.
  • If it reads 0, LED OFF.
  • Likewise we increase the counter from 0 to 3 one by one and display the binary number through LEDs.

Output pattern of the project :

The LEDs should glow showing the following pattern.

00 = 0
01 = 1
10 = 2
11 = 3
The LED display will be shown as:


Thanks for reading…. Try the above program and play with LEDs….Please leave your comments below…

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.