You are reading a single comment by @allObjects and its replies. Click here to read the full conversation.
  • @TeppoKurki,

    I guess you figure when connected - and powered over USB - you can make the upload of code to set the time - an option in the ide-settings... Unfortunately, as far as I know, any power cycle loses the time.

    You can power the pico from the batteries over the designated connector, then connect to usb, then upload the code into RAM with time setting - do not start your code / application yet, but have an onInit() function which includes the start of your code / application. While still connected, you can write the current time to Storage with function you call from console or with statements executed in the console. In your code, your read that time and compare it to the time stored - your hinted lower bound as a sanity check. If the stored time is ahead, you obviously got a power cycle and lost your time and you can signal that. You reconnect and you can set the time with some js statements in the console.

    To resolve time for good, get yourself a simple RTC clock module w/ battery backup - either Dallas DS1302 or DB3231. (I assume you had planned to have nothing else connected to Esuprino except the batteries and temp sensor(s)).

About

Avatar for allObjects @allObjects started