Hi there,
Still working on my fire alarm system. Hit a wall with the core "Sound Alarms" function.
Basically I am wanting to activate a beeping sound every 200ms when the "Sound Alarms" hex value is received by my picaxe. I've successfully made a loop to repeat the buzzer sound but I am wanting the loop to also perform a SERIN and IF statement. Just after the buzzer beeps I need the picaxe to find out if the silence button has been pressed and if it has, go to "SilenceAlarms" (set in my program) but if not, it should continue with the beeping. I have provided all my code, but the section with the problem is "SoundAlarms"; and my issue is that with my attempts the buzzer beeps once and the program hangs until I touch my LCD, where it beeps again- I think it has something to do with my IF statement, never quite managed to use the ELSEIF or other syntax.
For the system to go to the SilenceAlarms b18 = $19 and if not, continue the loop for the beeping.
What am I doing wrong? Sorry if this seems really dumb.
Still working on my fire alarm system. Hit a wall with the core "Sound Alarms" function.
Basically I am wanting to activate a beeping sound every 200ms when the "Sound Alarms" hex value is received by my picaxe. I've successfully made a loop to repeat the buzzer sound but I am wanting the loop to also perform a SERIN and IF statement. Just after the buzzer beeps I need the picaxe to find out if the silence button has been pressed and if it has, go to "SilenceAlarms" (set in my program) but if not, it should continue with the beeping. I have provided all my code, but the section with the problem is "SoundAlarms"; and my issue is that with my attempts the buzzer beeps once and the program hangs until I touch my LCD, where it beeps again- I think it has something to do with my IF statement, never quite managed to use the ELSEIF or other syntax.
Code:
#picaxe 40x2
#com 3
setfreq em64
'Symbols
symbol buzzer = B.7
symbol zone1 = B.6
symbol zone2 = B.5
symbol zone3 = B.4
symbol zone4 = B.3
symbol zone5 = B.2
symbol zone6 = B.1
symbol zone7 = B.0
symbol zone8 = D.7
symbol zone9 = D.6
symbol zone10 = D.5
symbol zone11 = D.4
symbol zone12 = C.7
symbol zone13 = C.6
symbol zone14 = C.5
symbol zone15 = A.5'C.4
symbol zone16 = D.3
symbol fireLED = D.1
symbol powerLED = D.0
symbol faultLED = A.6
symbol testLED = C.2
symbol disablementLED = C.1
symbol sysfltLED = C.0
symbol lcdtx = D.2
symbol lcdrx = A.7
start0:' Scans the LCD continuously and jumps to relevant section of menu in 'Start1'
serin A.7,N4800,($AA,$78),b17,b18',b19,b20,b21,b22,b23
debug
'****Display Test****
IF b18= $16 THEN GOTO HighTestLED : IF B18 = $FD OR B18 = $FE THEN GOTO LowTestLED
IF b18= $51 THEN GOTO StatusLEDTest
IF b18= $52 THEN GOTO ZoneLEDTest
IF b18= $54 THEN GOTO buzzertest
IF b18= $55 THEN GOTO LCDTest
'****Critical Events****
IF B18 = $06 OR B18 = $08 OR B18 = $60 THEN GOTO ActiveEvents
IF B18 = $17 THEN GOTO SoundAlarms
IF B18 = $19 THEN GOTO SilenceAlarms
IF B18 = $1B THEN GOTO ResetSystem
IF B18 = $11 THEN GOTO BuzzerCancel
goto start0
start1:
'Nothing goes in here yet!
goto start1
SoundAlarms: 'Sound alarms on system
High FireLED ' defined at top of program B.7
Do 'Start buzzer beeping
sound B.7,(123,50)
pause 200
serin A.7,N4800,($AA,$78),b17,b18 : IF B18 = $19 THEN GOTO SilenceAlarms : IF B18 <> $19 THEN EXIT
Loop ' go back to start of loop
Goto SoundAlarms
SilenceAlarms:
low FireLED
goto start0 '(start0 is a loop of the above used serin command)
What am I doing wrong? Sorry if this seems really dumb.