Common anode 7 segments display with MAX7219
2020-12-30 01:50:00
Code
#include "LedControl.h"
/*
pin 12 is connected to the DataIn
pin 11 is connected to the CLK
pin 10 is connected to LOAD
*/
LedControl lc=LedControl(12,11,10,3);
void print(byte d,byte n) {
lc.setColumn(0,d,pgm_read_byte_near(charTable + n));
}
void setup() {
lc.shutdown(0,false);
lc.setIntensity(0,9); // 0 to 15
lc.clearDisplay(0);
}
int first;
int second;
int third;
void loop() {
for(int base=0;base<1000;base++) {
first = base / 100 % 10;
second = base / 10 % 10;
fourth = base % 10;
print(1, first);
print(2, second);
print(3, third);
delay(10);
}
}