-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgpio.lua
More file actions
24 lines (20 loc) · 679 Bytes
/
gpio.lua
File metadata and controls
24 lines (20 loc) · 679 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-----------------------------
gpio.serout(4,gpio.LOW,{39950,99500},4, function() print("Configuring GPIOs ...") end)
-----------------------------
--Configure GPIO from TABLE
for k,v in pairs(config.GPIO) do
nr = tonumber(k)
if (v == "INPUT") then
gpio.mode(nr, gpio.INT, gpio.PULLUP)
print(v, " on Port", nr)
elseif (v == "OUTPUT") then
gpio.mode(nr, gpio.OUTPUT)
gpio.write(nr, gpio.LOW)
print(v, " on Port", nr)
elseif (v == "INT") then --interupt
gpio.mode(nr, gpio.INT)
print(v, " on Port", nr)
end
end
gpio.mode(4, gpio.OUTPUT, gpio.PULLUP) --maybe fix reset
-----------------------------