RMParkhouse
New Member
hey guys, im an electronics student doing AS electronics and im trying to get used to using PICAXE for a project so i set myself some problems to try and solve. this one is basically a car park which has 20 spaces, so i wrote the following:
symbol counter = b0
symbol in = 1
symbol out = 2
symbol open = 3
symbol full = 4
symbol cardI = 5
symbol cardO = 6
symbol sensorOUT = 7
symbol sensorIN = 8
main: for counter = 0 to 20
if cardO = 1 then flashOUT
if counter = 20 then stop
high open
if cardI = 1 then flashIN
flashIN:
high in
if sensorIN = 1 then flashIN
counter = counter + 1
low in
goto main
stop:
high full
low open
goto main
flashOUT:
high out
if sensorOUT = 1 then flashOUT
counter = counter - 1
low out
return
in is a barrier to get in
out is a barrier to get out
open is a light indicating spaces
full is a sign indicating no spaces
cardI is the card to get in
cardO is the card to get out
sensorIN is a sensor to check if the car is inside yet
sensorOUT is a sensor to check if the care is out yet
oh nd the pin numbers arent properly assigned but im not worried bout that, i just wanted to see if the program would work
now i know there are at least 3 or 4 mistakes so could people please point out what they are and maybe suggest some improvements, thnx
Edited by - RMParkhouse on 11/26/2005 10:29:20 AM
symbol counter = b0
symbol in = 1
symbol out = 2
symbol open = 3
symbol full = 4
symbol cardI = 5
symbol cardO = 6
symbol sensorOUT = 7
symbol sensorIN = 8
main: for counter = 0 to 20
if cardO = 1 then flashOUT
if counter = 20 then stop
high open
if cardI = 1 then flashIN
flashIN:
high in
if sensorIN = 1 then flashIN
counter = counter + 1
low in
goto main
stop:
high full
low open
goto main
flashOUT:
high out
if sensorOUT = 1 then flashOUT
counter = counter - 1
low out
return
in is a barrier to get in
out is a barrier to get out
open is a light indicating spaces
full is a sign indicating no spaces
cardI is the card to get in
cardO is the card to get out
sensorIN is a sensor to check if the car is inside yet
sensorOUT is a sensor to check if the care is out yet
oh nd the pin numbers arent properly assigned but im not worried bout that, i just wanted to see if the program would work
now i know there are at least 3 or 4 mistakes so could people please point out what they are and maybe suggest some improvements, thnx
Edited by - RMParkhouse on 11/26/2005 10:29:20 AM