Seven Segment Display Arduino

For a long time I did not post tutorials, because there are busy college and organization, so on this occasion I will post a basic tutorial using seven segments on arduino.

I will explain the seven segment . A seven-segment display (SSD), or seven-segment indicator, is a form of electronic display device for displaying decimal numerals that is an alternative to the more complex dot matrix displays. Seven-segment displays are used in digital clocks, electronic meters, basic calculators, and other electronic devices that display numerical information. Source : Wikipedia


Tools and Materials in use:

1.Arduino 1x
2. Seven Segment 1x
3. Cable Jumper
4. Protobot board
5. Laptop / PC

Schematic:



For Coding you can see below



//WWW.IOISALMAN.COM
//STEEMIT.COM/@SMOKHANTAS
//CREATED Salman Al Farisi 

byte seven_seg_digits[16][7] = { { 1,1,1,1,1,1,0 },  // = 0
                                 { 0,1,1,0,0,0,0 },  // = 1
                                 { 1,1,0,1,1,0,1 },  // = 2
                                 { 1,1,1,1,0,0,1 },  // = 3
                                 { 0,1,1,0,0,1,1 },  // = 4
                                 { 1,0,1,1,0,1,1 },  // = 5
                                 { 1,0,1,1,1,1,1 },  // = 6
                                 { 1,1,1,0,0,0,0 },  // = 7
                                 { 1,1,1,1,1,1,1 },  // = 8
                                 { 1,1,1,1,0,1,1 },   // = 9 
                                 { 1,1,1,0,1,1,1 },  //=A
                                 { 0,0,1,1,1,1,1 },  //=B
                                 { 1,0,0,1,1,1,0 },  //=C
                                 { 0,1,1,1,1,0,1 },  //=D
                                 { 1,0,0,1,1,1,1 },  //=E
                                 { 1,0,0,0,1,1,1 }, //=F                              
                                 };
   
void setup() {               
  pinMode(2, OUTPUT);  
  pinMode(3, OUTPUT);
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  pinMode(8, OUTPUT);
  pinMode(9, OUTPUT);
  writeDot(1); 
}
   
void writeDot(byte dot) {
  digitalWrite(9, dot);
}
   
void sevenSegWrite(byte digit) {
  byte pin = 2;
  for (byte segCount = 0; segCount < 7; ++segCount) {
    digitalWrite(pin, seven_seg_digits[digit][segCount]);
    ++pin;
    
  }
}
   
void loop() {
   
   for (byte count = 0; count < 15 ; ++count) {   
   sevenSegWrite(count);
   delay(1000);
   }
   
   for (byte count = 14; count > 0; --count) {
   sevenSegWrite(count-1);
   delay(1000);
   }
}

Subscribe to receive free email updates:

0 Response to "Seven Segment Display Arduino"

Post a Comment