Establishing Connection
0%
dim cnt as byte TMR0 = 96
INTCON = $20 ' set T0IE, claer T0IF
'scan input pin
if Button(GPIO, 5, 10, 1) then
state = true
else
state = false
end if
if state <> oldstate then
if state = true then
' change true/false below depending on whether your
' device goes high or low on triggering.
transmit2(false)
oldstate = state
end if
if state = false then
' send the opposite of above (change if required)
transmit2(true)
oldstate = state
end if
end if
end sub
main:
OPTION_REG = $84 ' assign prescaler to TMR0
'TRISIO = 0 ' designate gpio as output
TRISIO = %00100000 ' configure pin 5 of GPIO as input
GPIO = $0 ' initialize gpio
cnt = 0 ' initialize cnt
TMR0 = 96
lngCounter = 1
transmit(true)
delay_ms(3000)
transmit(false)
end if
loop until 0 = 1
end.