Welcome to the Parallax Discussion Forums, sign-up to participate.
10 let LED=16 20 direction(LED) = output 30 output(LED) = output(LED) xor 1 40 pausems 500 50 goto 30This will look pretty familiar to anyone who programmed in BASIC on 8 bit microcomputers. It's not really the way I'd choose to do it today, but flexBASIC supports this kind of old style BASIC programming so it is possible.
' declare which pin we will use const LED=16 ' set it as an output direction(LED) = output ' declare a subroutine to toggle a pin sub toggle(pin) output(pin) = output(pin) xor 1 end sub ' loop forever do toggle(LED) pausems(500) loopI've commented that better and broken the toggle operation out into a subroutine, but it's essentially the same program as the old style one (the compiler will generate pretty much the same code, too).
const LED = 16 sub forever( f as sub() ) f() forever(f) end sub direction(LED) = output forever( [: output(LED) = output(LED) xor 1 : pausems 500 :] )