Copyable Example Code
You can paste this into the code editor; still verify target image, region, color, text, and timing values in your own device flow.
-- Daily click counter
-- KV.increment raises a counter, KV.has checks a key
local today = DateTime.now():format("yyyy-MM-dd")
local key = "clicks_" .. today
-- First run of the day
if not KV.has(key) then
toast("New day: " .. today)
end
-- Raise the counter and read the new total
local total = KV.increment(key, 1)
toast("Clicks today: " .. total)
-- Alert at a threshold
if total == 100 then
System.vibrate(200)
System.noti("100 clicks reached today (" .. today .. ")")
end
-- How many days are stored
if KV.size() > 7 then
local allKeys = KV.keys()
toast("Stored days: " .. #allKeys)
end