I will probably phrase this wrong, how do i use the arduino to read two 4 bit bcd codes and call the corresponding code for that, so for example 0000 0000 would call for output(0x01, 0x00);
and 0000 0001 would be
output(0x01, 0x01);
the same digit except with 1 instead of 0.
The code i have running the max 7219 now though it doesn't do what i described as of yet.
#define MAX7219_DIN 7
#define MAX7219_CS 6
#define MAX7219_CLK 5
void initialise()
{
digitalWrite(MAX7219_CS, HIGH);
pinMode(MAX7219_DIN, OUTPUT);
pinMode(MAX7219_CS, OUTPUT);
pinMode(MAX7219_CLK, OUTPUT);
}
void output(byte address, byte data)
{
digitalWrite(MAX7219_CS, LOW);
shiftOut(MAX7219_DIN, MAX7219_CLK, MSBFIRST, address);
shiftOut(MAX7219_DIN, MAX7219_CLK, MSBFIRST, data);
digitalWrite(MAX7219_CS, HIGH);
}
void setup() {
// put your setup code here, to run once:
initialise();
output(0x0f, 0x00); //display test register - test mode off
output(0x0c, 0x01); //shutdown register - normal operation
output(0x0b, 0x07); //scan limit register - display digits 0 thru 7
output(0x0a, 0x0f); //intensity register - max brightness
output(0x09, 0xff); //decode mode register - CodeB decode all digits
output(0x08, 0x04); //digit 7 (leftmost digit) data
output(0x07, 0x02);
output(0x06, 0x00);
output(0x05, 0x04);
output(0x04, 0x02);
output(0x03, 0x00);
output(0x02, 0x04);
output(0x01, 0x02); //digit 0 (rightmost digit) data
}
void loop() {
// put your main code here, to run repeatedly:
}
EDIT: That is not my code, full credit for it goes to Julian Llett