- Notifications
You must be signed in to change notification settings - Fork1
jdevfullstack-tutorials/single-display-arduino-project
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a simple project in Arduino that usesthe breadboard, the Arduino UNO Board,the 7-Segment Display and basic programming.Take note, there are several ways to do thissame project but we'll focus on one.
The Arduino UNO Board is the basic boardfor beginners doing projects in Arduino.
As from the previous project, withouta microcontroller, your only control isthrough an external switch. And youare just limited to that.
The microcontroller will enable you toprogram electronic components so that youcan build digital devices that you wantto build.
The digital pins are the very first to beencountered because they can be used bycomponents in several ways. They will beconnected to the terminals of electroniccomponents.
The GND is the floating ground to completethe circuit. Remember, in an electrical setupthe earth ground is used extensively. Inelectronics, it's the convenience to usea floating ground.
The breadboard is your convenience for you tosimply put things in place. Plus,it provides connections either horizontallyor vertically for further ease. Becauseof this, you avoid overlapping wires:the metal strip at the bottom provides theconnection.
To not complicate things, we just use one 7-SegmentDisplay for the output. Remember, computer monitors'concept of display is the same: the dot-and-no-dotpattern to create a display, whether an imageor letter or numbers. You can do the same thingby using LEDs to serve as pixels.
But here in our project, we want to use the 7-SegmentDisplay as an upgrade from the basic LEDs. It's called7-Segment Display because there are seven segments ofLEDs, forming the number 8 unlighted.
The 7-Segment Display will either usecathode
oranode
. Make sure you got it right. It depends onyour circuit design.
There are just two default functions in Arduino:void setup
andvoid loop
.
void setup
is where you tell the Arduino board aboutthe common setup just like whether a digital pin willbe used as output or input.
void loop
is where the Arduino board executesall the commands you put there just likedigitalWrite
whether high or low.HIGH
meansthere is a voltage supplied just like turningit on through an external switch andLOW
meansthere is no voltage supplied or there is but istoo low. Voltage that is notsufficient will still be just like no voltage at all.
Using the TinkerCAD,here are the steps to create the project:
Make sure that you change the7-Segment Display common terminal to
cathode
.Follow the proper wiring:
Arduino Pin Segment Pin 13 G 12 F 11 A 10 B 9 E 8 D 7 C 6 DP Close the circuit by the GND. Use a resistorthat is exactly 200 ohms (left resistorwhen facing the screen) and 100 ohms forthe other one.left:
right:
Copy paste the program below:
unsigned const int A = 13;unsigned const int B = 12;unsigned const int C = 11;unsigned const int D = 10;unsigned const int E = 9;unsigned const int F = 8;unsigned const int G = 7;unsigned const int H = 6;void setup(void){ pinMode(A, OUTPUT); pinMode(B, OUTPUT); pinMode(C, OUTPUT); pinMode(D, OUTPUT); pinMode(E, OUTPUT); pinMode(F, OUTPUT); pinMode(G, OUTPUT); pinMode(H, OUTPUT);}//My Functionsvoid zero(void) { digitalWrite(A, LOW); digitalWrite(B, HIGH); digitalWrite(C, HIGH); digitalWrite(D, HIGH); digitalWrite(E, HIGH); digitalWrite(F, HIGH); digitalWrite(G, HIGH); digitalWrite(H, LOW);}void one(void) { digitalWrite(A, LOW); digitalWrite(B, LOW); digitalWrite(C, LOW); digitalWrite(D, HIGH); digitalWrite(E, LOW); digitalWrite(F, LOW); digitalWrite(G, HIGH); digitalWrite(H, LOW);}void two(void) { digitalWrite(A, HIGH); digitalWrite(B, LOW); digitalWrite(C, HIGH); digitalWrite(D, HIGH); digitalWrite(E, HIGH); digitalWrite(F, HIGH); digitalWrite(G, LOW); digitalWrite(H, LOW);}void three(void) { digitalWrite(A, HIGH); digitalWrite(B, LOW); digitalWrite(C, HIGH); digitalWrite(D, HIGH); digitalWrite(E, LOW); digitalWrite(F, HIGH); digitalWrite(G, HIGH); digitalWrite(H, LOW);}void four(void) { digitalWrite(A, HIGH); digitalWrite(B, HIGH); digitalWrite(C, LOW); digitalWrite(D, HIGH); digitalWrite(E, LOW); digitalWrite(F, LOW); digitalWrite(G, HIGH); digitalWrite(H, LOW);}void five(void) { digitalWrite(A, HIGH); digitalWrite(B, HIGH); digitalWrite(C, HIGH); digitalWrite(D, LOW); digitalWrite(E, LOW); digitalWrite(F, HIGH); digitalWrite(G, HIGH); digitalWrite(H, LOW);}void six(void) { digitalWrite(A, HIGH); digitalWrite(B, HIGH); digitalWrite(C, HIGH); digitalWrite(D, LOW); digitalWrite(E, HIGH); digitalWrite(F, HIGH); digitalWrite(G, HIGH); digitalWrite(H, LOW);}void seven(void) { digitalWrite(A, LOW); digitalWrite(B, LOW); digitalWrite(C, HIGH); digitalWrite(D, HIGH); digitalWrite(E, LOW); digitalWrite(F, LOW); digitalWrite(G, HIGH); digitalWrite(H, LOW);}void eight(void) { digitalWrite(A, HIGH); digitalWrite(B, HIGH); digitalWrite(C, HIGH); digitalWrite(D, HIGH); digitalWrite(E, HIGH); digitalWrite(F, HIGH); digitalWrite(G, HIGH); digitalWrite(H, LOW);}void nine(void) { digitalWrite(A, HIGH); digitalWrite(B, HIGH); digitalWrite(C, HIGH); digitalWrite(D, HIGH); digitalWrite(E, LOW); digitalWrite(F, HIGH); digitalWrite(G, HIGH); digitalWrite(H, LOW);}// Startvoid loop(void){ nine(); delay(1000); eight(); delay(1000); seven(); delay(1000); six(); delay(1000); five(); delay(1000); four(); delay(1000); three(); delay(1000); two(); delay(1000); one(); delay(1000); zero(); delay(1000);}
The code will simply have the countdownbut the individual function for a certainnumber can be used several times for yourown version. Simply invoke the functioninside the
void loop
.Of course, simulate the program!
Final Version: add a border using LEDswith your own pattern of blinking orgroup of LEDs of your own style.Make the
7-Segment Display
componentdisplay letters to form words that havesignificance to you. There should beat least 2 words presented and anothertwo groups of numbers like your birth date,year you were born, significant datein your life, lucky numbers for you, etc.Explain the significance by using comments.
About
a simple project in Arduino that uses the breadboard, the microcontroller, the 7-Segment Display and basic programming
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.