# Arduino Beginner Series: Project 2: Make a Binary Counter with LEDs

Hello everyone!! Welcome to this post on Arduino Projects!!
Need a short introduction to what the Arduino is then click on LINK
Check out the breadboard intro right HERE

Demo:

This is how my project turned out:

Things you will need:

1. Arduino UNO
2. USB A B cable
3. LEDs (any colour) x4
4. 220 ohm resistor x4
5. Computer with the Arduino IDE

Understanding Binary Numbers:

Before building a Binary Counter, we need to understand binary numbers. The video that I’ve linked below really helped me understand the concept of binary numbers and the hexadecimal system. So check it out!

Functions that we’ll be using:

Video Tutorial:

Here as video tutorial that I referred to (LINK). Though my code is different.

Code:

``````int led1=8;
int led2=9;
int led3=10;
int led4=11;
int wait=2000;

void setup() {
// put your setup code here, to run once:
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);

}

void loop() {
// put your main code here, to run repeatedly:
for(int i=0; i<2; i++){
for(int j=0; j<2; j++){
for(int k=0; k<2; k++){
for(int l=0; l<2; l++){
if(i==0){
digitalWrite(led4, LOW);
}

else {
digitalWrite(led4, HIGH);
}

if(j==0){
digitalWrite(led3, LOW);
}

else {
digitalWrite(led3, HIGH);
}

if(k==0){
digitalWrite(led2, LOW);
}

else {
digitalWrite(led2, HIGH);
}

if(l==0){
digitalWrite(led1, LOW);
}

else {
digitalWrite(led1, HIGH);
}

delay(wait);
}
}
}
}

}``````

Stay Tuned for upcoming posts on Arduino Projects! We’re on the basic newbie projects right now and slowly, gradually move on to those cool, ultra techy projects!! Want to be the first to know when a new and amazing post comes up?? Then feel free to subscribe!

This site uses Akismet to reduce spam. Learn how your comment data is processed.