[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/diy/ - Do It Yourself

Search:


View post   

>> No.713247 [View]
File: 2.33 MB, 2816x2112, DSC08374.jpg [View same] [iqdb] [saucenao] [google]
713247

>>713237
(continuing from last post)
//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
//Pin connected to DS of 74HC595
int dataPin = 11;
byte numbers[16][2] = {
{0x01,0x80}, //0
{0x07,0xB0}, //1
{0x05,0x40}, //2
{0x05,0x10}, //3
{0x03,0x30}, //4
{0x09,0x10}, //5
{0x09,0x00}, //6
{0x05,0xB0}, //7
{0x01,0x00}, //8
{0x01,0x10}, //9
{0x01,0x20}, //A
{0x0B,0x00}, //B
{0x09,0xC0}, //C
{0x07,0x00}, //d
{0x09,0x40}, //E
{0x09,0x60} //F
};

void setup() {
//Start Serial for debugging purposes
Serial.begin(9600);
//set pins to output because they are addressed in the main loop
pinMode(latchPin, OUTPUT);

}

void loop() {
//count up routine
for (int mil = 0; mil<16; mil++){
for (int cent = 0; cent < 16; cent++){
for (int dec = 0; dec < 16; dec++){
for (int unit = 0; unit < 16; unit++) {
for (int ms = 0; ms < 250; ms++){//refreshes for about 1 sec
write_n(unit,8);
write_n(dec,4);
write_n(cent,2);
write_n(mil,1);
}
}
}
}
}
}
write_n() in next post.
As for shiftOut(), I used the example for dual '595s from arduino.cc, you can get it from there.

>> No.713242 [DELETED]  [View]
File: 2.33 MB, 2816x2112, DSC08374.jpg [View same] [iqdb] [saucenao] [google]
713242

(continuing from last post)

//Pin connected to ST_CP of 74HC595
int latchPin = 8;
//Pin connected to SH_CP of 74HC595
int clockPin = 12;
//Pin connected to DS of 74HC595
int dataPin = 11;

/*byte numbers[32] = {
0x01,0x80, //0 0,1
0x07,0xB0, //1 2,3
0x05,0x40, //2 4,5
0x05,0x10, //3 6,7
0x03,0x30, //4 8,9
0x09,0x10, //5 10,11
0x09,0x00, //6 12,13
0x05,0xB0, //7 14,15
0x01,0x00, //8 16,17
0x01,0x10, //9 18,19
0x01,0x20, //A 20,21
0x0B,0x00, //b 22,23
0x09,0xC0, //C 24,25
0x07,0x00, //d 26,27
0x09,0x40, //E 28,29
0x09,0x60 //F 30,31
};*/

byte numbers[16][2] = {
{0x01,0x80}, //0 0,1
{0x07,0xB0}, //1 2,3
{0x05,0x40}, //2 4,5
{0x05,0x10}, //3 6,7
{0x03,0x30}, //4 8,9
{0x09,0x10}, //5 10,11
{0x09,0x00}, //6 12,13
{0x05,0xB0}, //7 14,15
{0x01,0x00}, //8 16,17
{0x01,0x10}, //9 18,19
{0x01,0x20}, //A 20,21
{0x0B,0x00}, //b 22,23
{0x09,0xC0}, //C 24,25
{0x07,0x00}, //d 26,27
{0x09,0x40}, //E 28,29
{0x09,0x60} //F 30,31
};

void setup() {
//Start Serial for debuging purposes
Serial.begin(9600);
//set pins to output because they are addressed in the main loop
pinMode(latchPin, OUTPUT);

}

void loop() {
//count up routine
for (int mil = 0; mil<16; mil++){
for (int cent = 0; cent < 16; cent++){
for (int dec = 0; dec < 16; dec++){
for (int unit = 0; j < 16; j++) {
for (int ms = 0; ms < 250; ms++){//refreshes for about 1 sec
write_n(unit,8);
write_n(dec,4);
write_n(cent,2);
write_n(mil,1);
}
}
}
}
}
}

write_n() in next post.
As for shiftOut(), I used the example for dual '595s from arduino.cc, you can get it from there.

Navigation
View posts[+24][+48][+96]