Hello everyone!
I have been trying to program a 7 segment display today and have had some luck. I have uploaded this code and the bottom and the DP light up. I have hooked up the segment to the arduino via pins 5-13. The common anode is at pin 13 and is working currently. I have no idea on how I got the decimal to light up, because I just initialized it as an output. All I am trying to do now is light up a number on the 7 segment display. After I make and complete this, I will try to make a dice, and then a library for the Arduino. Any help on just trying to make it display a number?
Thanks, qtechknow
/*
7-Segment Display
*/
const int DP = 5;
const int CA = 13;
int ledPins[] = { 6, 7, 8, 9, 10, 11, 12 };
int zero[] = { 7, 12, 6, 8, 10, 9 };
int one[] = { 6, 10 };
int two[] = { 7, 6, 11, 8, 9 };
int three[] = { 7, 6, 11, 10, 9 };
int four[] = { 12, 11, 6, 10 };
int five[] = { 7, 12, 11, 10, 9 };
int six[] = { 7, 12, 11, 8, 9, 10 };
int seven[] = { 7, 6, 10 };
int eight[] = { 7, 6, 12, 11, 10, 9, 8 };
int nine[] = { 7, 12, 6, 11, 10 };
void setup() {
// initialize the digital pins as outputs
pinMode(CA, OUTPUT);
pinMode(DP, OUTPUT);
pinMode(ledPins[6, 7, 8, 9, 10, 11, 12], OUTPUT);
}
void loop() {
digitalWrite(13, HIGH); // set the Common Anode high
digitalWrite(zero[7, 12, 6, 8, 9, 10], LOW); // display 0
}