I don't know enough C and circuit-python mnemonics to convert seconds to 28 year epoch, for rp2040 mcu scripts on WOKWI.
This first code block is my micropython attempt.
I don't know how to declare a 64 bit number and the variable containing the second must go up to 28 years in seconds.
I'm not sure circuit python supports double unsigned integers.
I guess I could just break this down into smaller integers since it's already broken down into smaller integers here. But I'd much rather find something that will support the whole giant number so that I can set the seconds to a basic calendar epoch(28 years)(in case it is off line for 28 years).
I'm trying to do this with internal commands (machine) (no import) just from the basic internal micropython interpreter which is resident in the RP2040.
https://wokwi.com/projects/370990490026911745
sec=604800-10
s=2
def tickjsj():
global sec
sec=sec+1
machine.Timer().init(period=1000, callback=lambda t:tickjsj())
while 1:
if s!=sec:
ss=int((sec/60-int(sec/60))*60)
m=int((sec/3600-int(sec/3600))*60)
h=int((sec/86400-int(sec/86400))*24)
d=int((sec/604800-int(sec/604800))*7)
# 4y=int((sec/126230400-int(sec/126230400)))
print("d=",d,"sumotuwethfrsa"[d*2:d*2+2],"h="+("0"+str(h))[-2:],"m="+("0"+str(m))[-2:],"s="+("0"+str(ss))[-2:],chr(13),end="")
s=sec
The second code block below is not fully working C that I Made by modifying a working script modified by the system operator from some other source can't say I don't appreciate the rem statements for the Addafruit driver of the OLED display even though ultimately I intend to use my own brewed of bitbanged serial driven 7 segment LED: https://wokwi.com/projects/372024462517265409
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
unsigned long x = 4294967295-100;
unsigned long sec=0;
unsigned long ss=0;
unsigned long m=0;
unsigned long h=0;
unsigned long d=0;
void setup() {
if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
Serial.println(F("SSD1306 allocation failed"));
for(;;); // Don't proceed, loop forever
}
display.setRotation(4); //sets rotation 1 through 4
display.display();
display.setTextColor(1); // Draw white text
display.setTextSize(3);
}
void loop() {
display.clearDisplay();
display.setCursor(0,0);
ss=x;
ss=int((sec/60-int(sec/60))*60);
m=int((sec/3600-int(sec/3600))*60);
h=int((sec/86400-int(sec/86400))*24);
d=int((sec/604800-int(sec/604800))*7);
//# 4y=int((sec/126230400-int(sec/126230400)))
//display.print("d=",d,"sumotuwethfrsa"[d*2:d*2+2],"h="+("0"+str(h))[-2:],"m="+("0"+str(m))[-2:],"s="+("0"+str(ss))[-2:],chr(13),end="");
display.print("d=");
display.print(d);
display.print("h=");
display.print(h);
display.print("m=");
display.print(m);
display.print("s=");
display.print(ss);
display.print(x);
display.display();
x++;
}
I don't know the "c" language mnemonics. Therefore the "INT" function translates into some other command or function with "C".
The micropython script won't count high enough. Because I can't get a high enough precision on the numeric value.