You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
657 B
28 lines
657 B
1 year ago
|
--Init GPIO params
|
||
|
function InitGPIO()
|
||
|
gpio.mode(0,gpio.OUTPUT);
|
||
|
gpio.mode(1,gpio.OUTPUT);
|
||
|
gpio.mode(2,gpio.OUTPUT);
|
||
|
gpio.mode(3,gpio.OUTPUT);
|
||
|
gpio.mode(4,gpio.OUTPUT);
|
||
|
gpio.write(0,gpio.LOW);
|
||
|
gpio.write(1,gpio.LOW);
|
||
|
gpio.write(2,gpio.LOW);
|
||
|
gpio.write(3,gpio.LOW);
|
||
|
gpio.write(4,gpio.LOW);
|
||
|
end
|
||
|
--Push gpio to high
|
||
|
function GPIOOn(gpioId)
|
||
|
if gpioId>=0 and gpioId<=4 then
|
||
|
gpio.write(gpioId,gpio.HIGH)
|
||
|
end
|
||
|
end
|
||
|
--Push gpio to low
|
||
|
function GPIOOff(gpioId)
|
||
|
if gpioId>=0 and gpioId<=4 then
|
||
|
gpio.write(gpioId,gpio.LOW)
|
||
|
end
|
||
|
end
|
||
|
InitGPIO();
|
||
|
print("gpio1-5 init over,turn all gpio to output,low")
|