How to get V-Box time with lua?

Last modified by Wecon on 2025/09/03 21:04

1.Demo 

function demo.main()

  --dosomething
print(os.date("%Y-%m-%d %H:%M:%S", os.time())) --getthe time from V-Box

local m0,m1

m0=os.date("%Y-%m-%d %H:%M:%S", os.time())  -- save year month date hour minute second to m0
addr_setstring("@W_0#HDW100",m0)            -- save m0 to HDW100,HDW100 is string format,format must use little-endian to display string

m1=os.date("%Y-%m-%d %H:%M", os.time())
if m1=="2021-06-11 12:20" then              -- use time to do control,print happy new year.
  
print("happy new year")
end

end

1623294016866-972.png

2.HDW100 configuration

1623293903580-761.png

1623293853465-476.png

3.Test with debug tool

1623293415665-171.png