I've changed your code a bit to make a simple RC Switch that turns on GPIO.1 in real time (ie activate the switch on the TX and the LED lights or goes out)
I've also removed some parts that are not needed (input GPIO.3 for example as PULSIN automatically makes the pin an input)
Good result for the end of the day.Code:'12F675 @ __CONFIG _INTRC_OSC_CLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF OPTION_REG.5 = 0 Pulselen var Byte HighCode Var Byte LowCode Var Byte clear highcode = 0 ' setup vars to be changed lowcode = 200 ' setup vars to be changed ReadPWM: PulsIn GPIO.3, 1,Pulselen If pulselen > highcode then Highcode = Pulselen If pulselen < LowCode and Pulselen > 50 then Lowcode = Pulselen if (Pulselen + 20) >= highcode then High GPIO.1 If (Pulselen - 20) <= LowCode Then low GPIO.1 GoTo ReadPWM




Bookmarks