Place to put your Basic demos and examples

Moderator: Mmiscool

User avatar
By Mmiscool
#27735
Code: Select alllet noOfBlinks = 0
let pin = 0
let blinkDelay = 1000
[top]
print "How many times to blink" noOfBlinks
textbox noOfBlinks
print "Pin To use"
textbox pin
print "Blink Delay"
textbox blinkDelay
button "Blink Me Please" [blinkMe]
button "Exit" [getMeOutOfHere]
wait
 
 
[blinkMe]
let x = 0
[blinkLoop]
let x = x + 1
po pin 1
delay blinkDelay
po pin 0
delay blinkDelay
if noOfBlinks >= x then goto [blinkLoop]
wait
 
 
[getMeOutOfHere]
end
User avatar
By flywire
#61542 I am very happy to get the LED to blink on the LoLin NodeMcu V3 Dev Board running ESP Basic 3.0.Alpha 66.

The code is updated for ESP Basic 3 at https://www.esp8266basic.com/blink-example.html. I modified code to display debug output and turn off pin (LED) when complete.
This will prompt the user to select the pin, blink duration and number of blinks to execute.

GPIO 2 is normally connected to an LED on the node mcu boards.
.
Image

Code: Select all​​noOfBlinks = 0
pin = 0
blinkDelay = 1000

[top]
print "How many times to blink"
textbox noOfBlinks
print "Pin To use"
textbox pin
print "Blink Delay"
textbox blinkDelay
button "Blink Me Please", [blinkMe]
button "Exit", [getMeOutOfHere]
wait
 
[blinkMe]
for x = 1 to noOfBlinks
  io(po,pin,1)
  delay blinkDelay
  io(po,pin,0)
  delay blinkDelay
  print "Blinked" ' Debug line
next x
io(po,pin,1)      ' Turn off pin
wait

[getMeOutOfHere]
end