Arduino Seven Seg
Arduino Seven Seg
Introduction :
Materials :
- Arduino Uno
- breadboard
- 1 x 7-segment display module
- jumper wires
Program Code:
//Library
#include "SevenSeg.h"
//Variables
int number=0; //Default number
int flag;
void setup() {
Serial.begin(9600);
//Defines the number of digits to be "numOfDigits" and the digit pins to be the
elements of the array "digitPins"
disp.setDigitPins ( numOfDigits , digitPins );
//Only for common cathode 7segments
disp.setCommonCathode();
//Control brightness (values 0-100);
disp.setDutyCycle(50);
void loop()
{
//Check if incoming data is available:
if (Serial.available() > 0)
{
// If it is, we'll use parseInt() to pull out only numbers:
number = Serial.parseInt();
flag=0;
}