Problem with code

tubby8me2

New Member
when using this code i have come across a problem. after there is no input to pin 4 it take about 10 seconds befor pins 1 and 2 come back on. does any one no the reason for this and possibly how to fix this.
Code:
main:
if pin 4 = 0 then armed
if pin 4 = 1 then disarm

armed:
high 1
high 2
goto main

disarm:
low 1
low 2
wait 2
goto main
 
Last edited:

inglewoodpete

Senior Member
I think you are missing a pulldown resistor on the input. The pin 'floats' once disconnected due to its high impedance and stray electromagnetic and electrostatic fields.
 

tubby8me2

New Member
i am using an 08. the "no input to pin 4" is basically just a switch being turned off.

what do you mean buy a pull down resistor.

also the code has been changed to what it should be
 

inglewoodpete

Senior Member
Have a look at Manual 3 - Interfacing. In particular the section called "Input Device Interfacing" on (about) page 25. The pullup or pulldown resistor is required to ensure that the input is never in an indeterminate state (not high and not low).
 
Top