picaxe code help?
here is the code for a breathnalayzer using picaxe14m2
ignore the if b2= as i have to experiment and get the values and i havent done so.
the code stores messages in eeprom and in the starting it operates a rgb led to create effects
the code:
low B.0'initialise lcd outpu
pause 500'wait for lcd to initialise
'load messages in eeprom
EEPROM 0,("NO ALCOHOL")
EEPROM 10,("ONE OR TWO DRINKS")
EEPROM 27,("BUZZED")
EEPROM 33,("DRUNK")
EEPROM 38,("WASTED")
EEPROM 44,("BLOW ON THE SENSOR FOR 5 SEC")
high b.2'red
pause 2000
low b.2
high b.3'green
pause 2000
low b.3
high b.4'blue
pause 2000
low b.4
pause 1000
high b.3,b.4'sky blue
pause 2000
low b.3,b.4
pause 1000
high b.2,b.4'pink
pause 2000
low b.2,b.4
pause 1000
high b.3,b.2'yellow
pause 2000
low b.3,b.2
pause 1000
high b.2,b.3,b.4'white
pause 2000
low b.2,b.3,b.4
pause 1000
for b0=45 to 75 'print blow on the sensor
read b0,b1
serout B.0,n2400,(254,1,b1)
next b0
main:readadc B.1,b0
if b2=54 then main1
if b2=45 then main2
if b2=45 then main3
if b2=45 then main4
if b2=245 then main5
goto main
main1:high b.3'on green led
for b3= 0 to 9'print no alcohol
read b3,b4'read eeprom locations 0to10
serout b.0,n2400,(254,1,b4)
next b3
low b.3
goto main
main2:high b.4'on blue led
for b5= 11 to 27
read b5,b6
serout b.0,n2400,(254,1,b6)
next b5
low b.4
goto main
main3:high b.3'sky blue
high b.4
for b7= 28 to 33
read b7,b8
serout b.0,n2400,(254,1,b8)
next b7
low b.3
low b.4
goto main
main4:high b.3'yellow
high b.2
for b9= 34 to 38
read b9,b10
serout b.0,n2400,(254,1,b0)
next b9
low b.3
low b.2
goto main
main5:high b.2'red danger
for b11= 39 to 44
read b11,b12
serout b.0,n2400,(254,1,b12)
next b11
low b.2
goto main
Discussions
Best Answer 9 years ago
Yes,the code will work as expected
R
9 years ago
You would/will be FAR FAR better off asking these specific Picaxe questions in their forum, they are very friendly - Give it a try.
Answer 9 years ago
i will try it
9 years ago
And what's the problem ?
STeve
Answer 9 years ago
i wrote the code so just check it if its correct