Upload files to ''
Quick example how to blink an LED using LUA programming language
This commit is contained in:
24
blinky.lua
Normal file
24
blinky.lua
Normal 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
|
Reference in New Issue
Block a user