7seg_numbers_arduino/README.md

64 lines
1.3 KiB
Markdown

# 7seg_numbers_arduino
This is a library for Arduino to display numbers on a 7 segment display. The library creates a display object, this object is initialized by passing an array of the pin numbers where each segment is connected. It is assumed that the pins array will have the following order: {pinA, pinB, pinC, pinD, pinE, pinF, pinG, pinDP}.
Once the object is created, to print a number use the function with the number's name. Here is an example that use the library to print all the numbers from 0 to 9 and then the DP.
```c++
#include <segNums.h>
int pins[8] = {2,3,4,5,6,7,8,9};
SegDisp disp(pins);
void setup(){
}
void loop(){
disp.zero(1);
delay(500);
disp.zero(0);
delay(500);
disp.one(1);
delay(500);
disp.one(0);
delay(500);
disp.two(1);
delay(500);
disp.two(0);
delay(500);
disp.three(1);
delay(500);
disp.three(0);
delay(500);
disp.four(1);
delay(500);
disp.four(0);
delay(500);
disp.five(1);
delay(500);
disp.five(0);
delay(500);
disp.six(1);
delay(500);
disp.six(0);
delay(500);
disp.seven(1);
delay(500);
disp.seven(0);
delay(500);
disp.eight(1);
delay(500);
disp.eight(0);
delay(500);
disp.nine(1);
delay(500);
disp.nine(0);
delay(500);
disp.dot(1);
delay(500);
disp.dot(0);
delay(500);
}
```