Hi. Let me preface that I am still learning how to code the Arduino platform. Someday this project will turn into a nixie clock once I truly learn how my shift register works, learn to code properly and learn to use SPI. My plan is to get the clock digit to display on these nixie tubes using an array. Right now I am driving three nixie tubes off of one HV5622 shift register. It's working as I wanted it to scrolling through each digit of the three nixie tubes. I looked around on how best to use hex and fell flat on my research. So instead I just reckoned what the 2^n power was then converted to hex using a hex calculator. I thought such large numbers would definitely include alpha characters. To my surprise the conversion each time yielded a number format.
I'd like to be able to make the array more readable if someone was perusing the code. I intend on posting it up someday to share with the community. Pointers, links, guidance and constructive criticism appreciated.
#define NUM_LEADS 31
int clockPin = 0;
int latchPin = 1;
int dataPin = 2;
long sequence[31] = {
//[ 1(2^0), 2(2^1), 3(2^2), 4(2^3), 5(2^4), 6(2^5), 7(2^6), 8(2^7), 9(2^8), 0(2^9)]
0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, 0x100, 0x200,
//[ 2^10 , 2^11 , 2^12 , 2^13 , 2^14 , 2^15 , 2^16 , 2^17 , 2^18 , 2^19 ]
0x400, 0x800, 0x1000, 0x2000, 0x4000, 0x8000, 0x10000, 0x20000, 0x40000, 0x80000,
0x100000, 0x200000, 0x400000, 0x800000, 0x1000000, 0x2000000, 0x4000000, 0x8000000, 0x10000000, 0x20000000,
0x40000000};
void setup() {
pinMode(clockPin, OUTPUT);
pinMode(latchPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
void loop() {
for (int i = 0; i < NUM_LEADS; i++)
{
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, sequence[i] >> 24);
shiftOut(dataPin, clockPin, MSBFIRST, sequence[i] >> 16);
shiftOut(dataPin, clockPin, MSBFIRST, sequence[i] >> 8);
shiftOut(dataPin, clockPin, MSBFIRST, sequence[i]);
digitalWrite(latchPin, HIGH);
delay(80);
}
}