-
Notifications
You must be signed in to change notification settings - Fork 9
/
Gettingstarted LEDblink
25 lines (22 loc) · 1 KB
/
Gettingstarted LEDblink
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--/////////////////////////////////////////Start of Code//////////////////////////////////////////////////////////////
function blinktest()
for i = 1, 10, 1 do -- blink LED 50 times
gpio.write(0, gpio.HIGH) -- note onboard Blue LED is OFF when GPIO0 is high.
gpio.write(1, gpio.HIGH) -- RED LED is ON when GPIO1 is high.
print("Red ON ",i)
tmr.delay(500000) -- wait for 0.5 sec = 500 000 micro-sec
gpio.write(0, gpio.LOW) -- note onboard Blue LED is ON when GPIO0 is Low.
gpio.write(1, gpio.LOW) -- -- RED LED is OFF when GPIO1 is low.
print("Red OFF ",i)
i = i + 1;
tmr.delay(500000) -- wait for 0.5 sec = 500 000 micro-sec
end
end
function testnodemcu()
blinktest()
tmr.delay(10000) -- wait for 10micorsec
print("Congratulations for your first successfull NODEMCU E12 LED blink Test")
gpio.write(0, gpio.HIGH) -- swtich OFF Blue LED at the end
end
testnodemcu() -- function to run the test script
--///////////////////END of CODE///////////////////////////////