-
Notifications
You must be signed in to change notification settings - Fork 0
/
7seg.ino
52 lines (47 loc) · 1.56 KB
/
7seg.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#define onesPin 19
#define tensPin 18
#define hundredsPin 16
#define thousandsPin 17
char characters[16]= { //0 is light on, 1 is light off
0b00000011, //0
0b10011111, //1
0b00100101, //2
0b00001101, //3
0b10011001, //4
0b01001001, //5
0b01000001, //6
0b00011111, //7
0b00000001, //8
0b00011001, //9
0b00010001, //A
0b11000001, //B
0b01100011, //C
0b10000101, //D
0b01100001, //E
0b01110001 //F
};
int ones; //time integer, seconds place
int tens; //time integer, tens place
void setup() {
Serial.begin(9600);
Serial.print("Hello, "); //for debugging
Serial.println("World");
ones = 0;
tens = 0;
// put your setup code here, to run once:
pinMode(thousandsPin, OUTPUT);
digitalWrite(thousandsPin, LOW);
pinMode(hundredsPin, OUTPUT);
digitalWrite(hundredsPin, LOW);
pinMode(onesPin, OUTPUT);
digitalWrite(onesPin, LOW);
pinMode(tensPin, OUTPUT);
digitalWrite(tensPin, LOW);
DDRD = 255; //sets data direction register D to be an output
PORTD = 255; //when port D is 0 lights are on. 255 lights off
}
void loop() {
}
void displayCharacter(char c) {
PORTD = c;
}