The project I am working on needs the Clock to be set to the current Date/Time. Its a bit of a pain doing this every time the device restarts so I now use the following batch file (setClock.bat) from my desktop (assumes COM5 & instance of Clock called clk):
@echo off
for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j
set ldt=%ldt:~0,4%-%ldt:~4,2%-%ldt:~6,2%T%ldt:~8,2%:%ldt:~10,2%:%ldt:~12,6%
echo clk.setClock((new Date("%ldt%")).valueOf())>COM5
(Ensure the IDE isn't connected)
Don't ask me to explain it in any detail (used some googled code!)
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
The project I am working on needs the Clock to be set to the current Date/Time. Its a bit of a pain doing this every time the device restarts so I now use the following batch file (setClock.bat) from my desktop (assumes COM5 & instance of Clock called clk):
(Ensure the IDE isn't connected)
Don't ask me to explain it in any detail (used some googled code!)
Maybe there is an easier way?