In other languages it could do the following.
snippet from the actual code I'm running.
I tried to do this for a picaxe but I can't use "()" so the code fails when "that1" is equal to 1. How can I do if and/or statements?if (this1 = 0 and this2 = 1 and this3 = 0) or that1 = 1 thendo somethingend if
snippet from the actual code I'm running.
Code:
#picaxe 20m2
symbol redOut = c.5
symbol grnOut = c.3
symbol bluOut = c.2
symbol dip4 = Pinc.0
symbol dip3 = Pinc.1
symbol dip2 = Pinc.4
symbol dip1 = Pinc.6
symbol cnt = b0
symbol last = b1
symbol nxt = b2
symbol stage = b3
symbol phase = b4
symbol phaselast = b5
symbol rndm = w10
symbol bright = w11
symbol bright2 = w12
symbol rndmphase = w10
initialize:
setfreq m8
main:
do until stage <> last[INDENT] random rndm
stage = rndm // 7 + 1[/INDENT]
loop
last = stage
if dip1 = 1 then[INDENT] do until phase <> phaselast[INDENT] random rndmphase
phase = rndmphase // 3 + 1[/INDENT]
loop
phaselast = phase[/INDENT]
end if
if dip2 = 1 and dip3 = 0 and dip4 = 0 or phase = 1 then[INDENT] select case stage
case = 1[INDENT] gosub red
pause 5000[/INDENT]
case = 2[INDENT] gosub green
pause 5000[/INDENT]
case = 3[INDENT] gosub blue
pause 5000
[/INDENT]
case = 4[INDENT] gosub purple
pause 5000[/INDENT]
case = 5[INDENT] gosub orange
pause 5000[/INDENT]
case = 6[INDENT] gosub yellow
pause 5000[/INDENT]
case = 7[INDENT] gosub white
pause 5000[/INDENT]
endselect[/INDENT]
end if
Last edited by a moderator: