intwoit2002
New Member
Hi all
I am a new be to this and have only coded in basic 17 years ago. So I am a non informed person.
Here is my situation I am trying to implement a monitor for my sump pump systems. Right now it is strictly to watch and not control the pumps. I have written a piece of code (first ever for this) which gives me a syntax error at the if then. What I am trying to do is monitor an input and when it goes lo have it turn on an output to light a led. I am going to attach the code.
#picaxe 18m2
symbol Float_Switch = pinb.2 'float sw. input lo = switch on
symbol Serial_Out = c.3
symbol Serial_In = c.4
symbol Test_Mode = b.0 'tests leds and sounder and ext alarm flashers
symbol Pump_On = c.2 'goes hi when pump has 120 volts
symbol OverFlow_Float_Switch = pinb.3 'goes lo whn over flow sw on
symbol Motor_Current = b.4 'Current loop input to ADC
symbol Motor_Stall_Led = b.5 'Led indicates stall goes low stall
symbol Motor_running_Led = b.6 'Led indicates normal current goes lo when running
symbol Piezo_sounder = b.7
symbol Ext_Test_Mode = c.6 'Allows ext control of test mode
symbol Alarm_Mode = c.7 'Alarm when over current, loss of power '' ; motor over flow sw is on goes high on alarm
symbol Pump_On_Led = c.0 'On when power to pump and current from b.4
symbol Pump_Fail_Led = c.1 'On when no power to pump and no current from b.4
symbol float_sw = b4
;power on test mode
POWER_TEST:
pinc.5 = 1 'turn on test led
pause 1000
pinc.2 = 1 'turn on oferflow led
pause 1000
pinc.0 = 1 'turn on pump on led
pause 1000
pinc.1 = 1 'turn on pump fail led
pause 1000
pinc.7 = 1 'turn on alarm led
pause 3000 'all leds on for 3 seconds
pinc.7 = 0
pause 550 'Turn all leds off after pause
pinc.1 = 0
pause 550
pinc.1 = 0
pause 550
pinc.0 = 0
pause 550
pinc.2 = 0
pause 550
pinc.5 = 0
goto MAIN
MAIN:
if Float_Switch = 0 then Pump_On_Led = 1 'main float switch is on
'pump on led is on
if pinb.3 = 0 then endif 'overflow loat switch is on
'overflow led on
Thank you so much and look forward to an answer to a obvious question doing something wrong.
Al
I am a new be to this and have only coded in basic 17 years ago. So I am a non informed person.
Here is my situation I am trying to implement a monitor for my sump pump systems. Right now it is strictly to watch and not control the pumps. I have written a piece of code (first ever for this) which gives me a syntax error at the if then. What I am trying to do is monitor an input and when it goes lo have it turn on an output to light a led. I am going to attach the code.
#picaxe 18m2
symbol Float_Switch = pinb.2 'float sw. input lo = switch on
symbol Serial_Out = c.3
symbol Serial_In = c.4
symbol Test_Mode = b.0 'tests leds and sounder and ext alarm flashers
symbol Pump_On = c.2 'goes hi when pump has 120 volts
symbol OverFlow_Float_Switch = pinb.3 'goes lo whn over flow sw on
symbol Motor_Current = b.4 'Current loop input to ADC
symbol Motor_Stall_Led = b.5 'Led indicates stall goes low stall
symbol Motor_running_Led = b.6 'Led indicates normal current goes lo when running
symbol Piezo_sounder = b.7
symbol Ext_Test_Mode = c.6 'Allows ext control of test mode
symbol Alarm_Mode = c.7 'Alarm when over current, loss of power '' ; motor over flow sw is on goes high on alarm
symbol Pump_On_Led = c.0 'On when power to pump and current from b.4
symbol Pump_Fail_Led = c.1 'On when no power to pump and no current from b.4
symbol float_sw = b4
;power on test mode
POWER_TEST:
pinc.5 = 1 'turn on test led
pause 1000
pinc.2 = 1 'turn on oferflow led
pause 1000
pinc.0 = 1 'turn on pump on led
pause 1000
pinc.1 = 1 'turn on pump fail led
pause 1000
pinc.7 = 1 'turn on alarm led
pause 3000 'all leds on for 3 seconds
pinc.7 = 0
pause 550 'Turn all leds off after pause
pinc.1 = 0
pause 550
pinc.1 = 0
pause 550
pinc.0 = 0
pause 550
pinc.2 = 0
pause 550
pinc.5 = 0
goto MAIN
MAIN:
if Float_Switch = 0 then Pump_On_Led = 1 'main float switch is on
'pump on led is on
if pinb.3 = 0 then endif 'overflow loat switch is on
'overflow led on
Thank you so much and look forward to an answer to a obvious question doing something wrong.
Al