Ok so here it is Im stupid was the main problem. Somehow I figured that the signal would just come pouring out of that little white wire without any ground to the signal cable... Once I got over that blonde moment everything fell into place. The code below could be done a lot better and some saftys put in for wild RC signals but I wanted to get out some working code.
Basically by moving the stick back and forth it will figure out whats the max high and low and then accept anything thats about 1/3 of that in that direction. Now that its clear as mud here is the code
Code:'12F675 @ __CONFIG _INTRC_OSC_CLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF OPTION_REG.5 = 0 ' clock source internal Pulselen var Byte ' Pulselen can be 0 - 255, 100 = 1 ms, 200 = 2 ms Init var Byte ' Init used to flash LED HighCode Var Byte LowCode Var Byte clear highcode = 0 ' setup vars to be changed lowcode = 200 ' setup vars to be changed Input GPIO.3 ' set pin 5 to RX signal ReadPWM: PulsIn GPIO.3, 1,Pulselen ' pin 4 - read high pulse length, times out after .65535 seconds If pulselen > highcode then Highcode = Pulselen ' make sure highcode is at full throw This will avoid having to go though a setup If pulselen < LowCode and Pulselen > 50 then Lowcode = Pulselen ' make sure lowcode is at full throw This will avoid having to go though a setup if (Pulselen + 20) >= highcode then For Init = 1 To 6 High GPIO.1 pause 60 Low GPIO.1 pause 60 Next pause 1000 endif If (Pulselen - 20) <= LowCode Then High GPIO.1 pause 3000 Low GPIO.1 pause 200 endif GoTo ReadPWM





Bookmarks