This is just a goofy little practice program that I am attempting to learn how to use 'outpins'. When I run it in the simulator (PICAXE editor 6.0.5.9) it steps through all the lines in the program, but it doesn't give me an indication on the graphic which pins are going high and low. It works if I use direct commands e.g. 'high B.1'.
Is this a glitch in the editor or am I missing something with the 'outpins' usage?
Is this a glitch in the editor or am I missing something with the 'outpins' usage?
Code:
' ================= Cylon3v2.bas ==================
' See if you can figure out how this version works.
' === Constants ===
symbol abit = 100 ' used to slow down
' === Variables ===
symbol index = b0 ' used in for/next loops
symbol LEDs = outpinsB ' used to vary lit LEDs
' === Directives ===
#com 4 ' specify serial port
#picaxe 18M2 ' specify processor
#terminal off ' disable terminal window
' ============== Begin Main Program ===============
do
let outpinsB = %00000001 ' light 1 on left
pause abit ' slow down a bit
let outpinsB = %00000011 ' light 2 on left
pause abit ' slow down a bit
LEDs = %00000111 ' initialize LEDs
for index = 1 to 9 ' for 9 "triplets"
let outpinsB = LEDs ' light 3 (or 2 or 1)
LEDs = LEDs * 2 ' shift right
pause abit ' slow down a bit
next index
wait 1
let outpinsB = %10000000 ' light 1 on right
pause abit ' slow down a bit
let outpinsB = %11000000 ' light 2 on right
pause abit ' slow down a bit
LEDs = %11100000 ' initialize LEDs
for index = 9 to 1 step -1 ' for 9 "triplets"
let outpinsB = LEDs ' light 3 (or 2 or 1)
LEDs = LEDs / 2 ' shift left
pause abit ' slow down a bit
next index
wait 1
loop