Here's my sketch in case someone wants to look at it.
I did a check with my multimeter and the more pins at set HIGH on the shift register, the less voltage I get. Is there something I need to add to my setup to tackle that. For the moment, it's the numitrons legs straight to the shift register. I going to try to illustrate it.
//Pin to clear the register
const int clearPin = 7;
//Pin connected to latch pin (ST_CP) of 74HC595
const int latchPin = 8;
//Pin connected to clock pin (SH_CP) of 74HC595
const int clockPin = 12;
////Pin connected to Data in (DS) of 74HC595
const int dataPin = 11;
/*
Russian Datasheet
0: 3,4,5,6,8,9
1: 3,4
2: 3,5,7,8,9
3: 3,4,5,7,8
4: 3,4,6,7
5: 4,5,6,7,8
6: 4,5,6,7,8,9
7: 3,4,5
8: 3,4,5,6,7,8,9
9: 3,4,5,6,7,8
<: 2
*/
//Numbers
const byte numbers[11][8] = {
{1, 1, 0, 1, 1, 1, 1, 0},
{0, 0, 0, 0, 0, 1, 1, 0},
{1, 1, 1, 0, 1, 0, 1, 0},
{0, 1, 1, 0, 1, 1, 1, 0},
{0, 0, 1, 1, 0, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 0, 0},
{1, 1, 1, 1, 1, 1, 0, 0},
{0, 0, 0, 0, 1, 1, 1, 0},
{1, 1, 1, 1, 1, 1, 1, 0},
{0, 1, 1, 1, 1, 1, 1, 0},
{0, 0, 0, 0, 0, 0, 0, 1},
};
void setup() {
//set pins to output because they are addressed in the main loop
pinMode(clearPin, OUTPUT);
pinMode(latchPin, OUTPUT);
digitalWrite(latchPin, LOW);
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
registerOff();
Serial.begin(9600);
// delay a little and then set
delay(100);
// Always start by sentting SRCLR high
digitalWrite( clearPin, HIGH);
}
void loop() {
/*
//Counting (ignore the last one)
for (int n = 0; n < 10; n++) {
while (!wait(1000, false, " ")) {
for (int i = 0; i < 8; i++) {
if (numbers[n][i] == 1) registerWrite(i, HIGH);
else registerWrite(i, LOW);
}
}
//delay(100);
wait(100, true, "Reset");//reset Wait timer.
}
*/
//Manual Test
registerWrite(0, HIGH);
registerWrite(1, HIGH);
registerWrite(2, HIGH);
/*
//Goes through all filaments one by one);
for (int i = 0; i < 8; i++) {
registerWrite(i, HIGH);
delay(1000);
registerWrite(i, LOW);
}
*/
}
// This method sends bits to the shift register:
void registerOff() {
for (int i = 0; i < 8; i++) {
registerWrite(i, LOW);
delay(100);
}
}
/*Not mine, from tutorial*/
void registerWrite(int whichPin, int whichState) {
// the bits you want to send
byte bitsToSend0 = 0;
// write number as bits
bitWrite(bitsToSend0, whichPin, whichState);
// turn off the output so the pins don't light up
// while you're shifting bits:
digitalWrite(latchPin, LOW);
// shift the bits out
shiftOut(dataPin, clockPin, MSBFIRST, bitsToSend0);
// turn on the output so the LEDs can light up:
digitalWrite(latchPin, HIGH);
}