I am trying to make a single tube Nixie clock using a DS3231
The clock works fine but I need help to turn off the digets as it cycles/flashes through the time.
It is particularly a problem when there double numbers for example 11:11 in my code just shows the 1 continuously, what I would like it to do is blink the 1 four times followed by a longer pause.
This is my code
float HOURS = 00;
float MINS = 00;
#include <DS3231_Simple.h> // Attached to I2C
DS3231_Simple Clock;
byte A = 10; //pins for the inputs on the Russian version of SN74141
byte B = 11;
byte C = 12;
byte D = 13;
void setup() {
Clock.begin();
pinMode(A, OUTPUT);
pinMode(B, OUTPUT);
pinMode(C, OUTPUT);
pinMode(D, OUTPUT);
nixieWrite(A, B, C, D, 0);
}
void nixieWrite(uint8_t a, uint8_t b, uint8_t c, uint8_t d, uint8_t value) {
//D is most significant bit
//A is least significant bit
digitalWrite(d, (value & 0x08) >> 3);
digitalWrite(c, (value & 0x04) >> 2);
digitalWrite(b, (value & 0x02) >> 1);
digitalWrite(a, value & 0x01);
}
void loop() {
// Create a variable to hold the data
DateTime MyDateAndTime;
// Ask the clock for the data.
MyDateAndTime = Clock.read();
HOURS = (MyDateAndTime.Hour);
MINS = (MyDateAndTime.Minute);
//////////FOR A TIME HOURS = 12 and MINUTES = 34
float TV1 = HOURS / 10; // 12 / 10 = 1.2
int FDiget = TV1; // First Diget.... Remove decimal = 1
int TV2 = FDiget * 10; // 1*10=10
int SDiget = HOURS - TV2; //Second Diget 12-10=2
float TV4 = MINS / 10; // 34/4=3.4
int TDiget = TV4; // Third Diget remove decimal = 3
int TV5 = TDiget * 10; // 3 * 10 = 30
int LastDiget = MINS - TV5; // Last Diget 34 -30 = 4
nixieWrite(A, B, C, D, FDiget);
delay (500) ;
nixieWrite(A, B, C, D, SDiget);
delay (500) ;
nixieWrite(A, B, C, D, TDiget);
delay (500) ;
nixieWrite(A, B, C, D, LastDiget);
delay (1500);
}
Any help would be appreciated ![]()