Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

a simple project in Arduino that uses the breadboard, the microcontroller, the 7-Segment Display and basic programming

NotificationsYou must be signed in to change notification settings

jdevfullstack-tutorials/single-display-arduino-project

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 

Repository files navigation

sample project

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

board

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

pins

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

gnd

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

breadboard

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.

The 7-Segment Display

display

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.

display2

The 7-Segment Display will either usecathode oranode. Make sure you got it right. It depends onyour circuit design.

The Arduino Code

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.

Project Guide

Using the TinkerCAD,here are the steps to create the project:

  1. Make sure that you change the7-Segment Display common terminal tocathode.setup

  2. Follow the proper wiring:

    Arduino PinSegment Pin
    13G
    12F
    11A
    10B
    9E
    8D
    7C
    6DP
  3. 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:leftright:right

  4. 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 thevoid loop.

  5. Of course, simulate the program!

  6. Final Version: add a border using LEDswith your own pattern of blinking orgroup of LEDs of your own style.Make the7-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

Stars

Watchers

Forks


[8]ページ先頭

©2009-2025 Movatter.jp