Madhur Bajpai
Published © GPL3+

Binary Counter using LEDS

An entry level, fun project that counts up in BINARY up to 4 bits and blinks LEDS representing the same.

BeginnerFull instructions provided3 hours24,443
Binary Counter using LEDS

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
LED (generic)
LED (generic)
LEDS can be either of the same color or different depending on how appealing you want it to be.
×4
Resistor 1k ohm
Resistor 1k ohm
×4
Solderless Breadboard Half Size
Solderless Breadboard Half Size
×1
Plastic Enclosure, Project Box
Plastic Enclosure, Project Box
×1
Jumper wires (generic)
Jumper wires (generic)
×5
9V battery (generic)
9V battery (generic)
×1
9V Battery Clip
9V Battery Clip
×1

Software apps and online services

Arduino IDE
Arduino IDE
Tinkercad
Autodesk Tinkercad
If you don't want to risk burning out your components this is an easy online simulation software. Cheers!!

Hand tools and fabrication machines

Wire Cutter / Stripper, 5.25 " Overall Length
Wire Cutter / Stripper, 5.25 " Overall Length
Scissor, Electrician
Scissor, Electrician

Story

Read more

Schematics

Circuit Schematic

The diagram shows the connections for this project with each wire layered with the color according to LED it is connected to.

Code

Arduino 4BIT_Counter

Arduino
int pin1=11;  //initializing pins as vars beacuse who wants to use constants:
int pin2=10;
int pin3=9;
int pin4=8;
int timr=1000;
int i=0;
void setup() {
  // put your setup code here, to run once:

pinMode(pin1,OUTPUT);
pinMode(pin2,OUTPUT);pinMode(pin3,OUTPUT);pinMode(pin4,OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:
  
digitalWrite(pin4,LOW);
digitalWrite(pin3,LOW);
digitalWrite(pin2,LOW);
digitalWrite(pin1,LOW);
delay(timr);

i++; //We start the counter:

if((i % 2) > 0) { digitalWrite(pin1, HIGH); } else { digitalWrite(pin1, LOW); }

if((i % 4) > 1) { digitalWrite(pin2, HIGH); } else { digitalWrite(pin2, LOW); }

if((i % 8) > 3) { digitalWrite(pin3, HIGH); } else { digitalWrite(pin3, LOW); }

if((i % 16) > 7) { digitalWrite(pin4, HIGH); } else { digitalWrite(pin4, LOW); }

delay(timr);

}

Credits

Madhur Bajpai
1 project • 1 follower
Hi!! I am currently pursuing EE Engineering and am interested in integrating Arduino projects with Photovoltaics for remote operations.
Contact

Comments

Please log in or sign up to comment.