Introduction: 7-segment Display With Linkit One


In this tutorial I will tell about displaying 0-9 digits on 7 Segment Display using Linkit one.7 segment display is very useful and effective way to represent numeric values and it is actually a 8-segment display due to presence of a point on right side of 8.

Step 1: Things Required

We need :-

  • Linkit one
  • jumper wires
  • 7-segment display
  • 220 ohm resistors
  • Breadboard

Step 2: Code

int a = 2; //For displaying segment "a"int b = 3; //For displaying segment "b"

int c = 4; //For displaying segment "c" int d = 5; //For displaying segment "d" int e = 6; //For displaying segment "e" int f = 8; //For displaying segment "f" int g = 9; //For displaying segment "g"void setup() { pinMode(a, OUTPUT); //A pinMode(b, OUTPUT); //B pinMode(c, OUTPUT); //C pinMode(d, OUTPUT); //D pinMode(e, OUTPUT); //E pinMode(f, OUTPUT); //F pinMode(g, OUTPUT); //G }void displayDigit(int digit) { //Conditions for displaying segment a if(digit!=1 && digit != 4) digitalWrite(a,HIGH); //Conditions for displaying segment b if(digit != 5 && digit != 6) digitalWrite(b,HIGH); //Conditions for displaying segment c if(digit !=2) digitalWrite(c,HIGH); //Conditions for displaying segment d if(digit != 1 && digit !=4 && digit !=7) digitalWrite(d,HIGH); //Conditions for displaying segment e if(digit == 2 || digit ==6 || digit == 8 || digit==0) digitalWrite(e,HIGH); //Conditions for displaying segment f if(digit != 1 && digit !=2 && digit!=3 && digit !=7) digitalWrite(f,HIGH); if (digit!=0 && digit!=1 && digit !=7) digitalWrite(g,HIGH); } void turnOff() { digitalWrite(a,LOW); digitalWrite(b,LOW); digitalWrite(c,LOW); digitalWrite(d,LOW); digitalWrite(e,LOW); digitalWrite(f,LOW); digitalWrite(g,LOW); }

void loop() { for(int i=0;i<10;i++) { displayDigit(i); delay(1000); turnOff(); } }

Step 3: Arrangements

This is very simple you can check the picture for better understanding.The first argument is used to display number and the second one is for point.It is basically a set of 8 light emitting diodes with common negative terminal as we provide + voltage from arduino digital pins.

Step 4: Done!!

You can use this for displaying numbers on a 7-segment display and use it in your projects.

Best of luck!!

Thank you!!


About This Instructable




Bio: Thank you instructables!!
More by Gursimran Singh 425:Plant BoxDIY CNC For 60$ (Large Work Area)Advanced Mosquito Repeller and Swatter
Add instructable to: