Upload files to ''

Quick example how to blink an LED using LUA programming language
This commit is contained in:
2022-07-01 01:26:25 +02:00
parent a8f17f024e
commit a322b0bf4f

24
blinky.lua Normal file
View File

@@ -0,0 +1,24 @@
local GPIO = require('periphery').GPIO
local clock = os.clock
local gpio_4 = GPIO(4, "out")
function sleep(n)
local t0 = clock()
while clock() - t0 <= n do end
end
--function wait(seconds) -- This function doesnt give real seconds
-- local start = os.time()
-- repeat until os.time() > start + seconds
--end
while 1
do
gpio_4:write(0)
sleep(2)
-- wait(2)
gpio_4:write(1)
sleep(0.2)
-- wait(0.2)
end