Code for RF reciever

tmack

Member
Can anyone help me out by giving me an example of a basic code that could be used to make a pin on an 08 go high/ low when it recieves pulses from a hobby type rf radio (That usually drives a servo..) ? Thanks for any help.
 
Take a look at the code shown on this thread "Pulsin with a simple 8M program " The RC servos receive pulses with values between .75 and 2.25ms. With .75 been one extreme of the servo travel, 1.50 in the middle and 2.25 the other extreme.
With the pulsin command you get the value of the pulse length (anything between 75 and 225) then use an If statement to decide what to do.
 
Last edited:

tmack

Member
So I could just set the pulsin, then make a pin go high when it recieves 2.25 and low when it recieves .75?
 

tmack

Member
Will this work?


Main:
Symbol RX=Input3
'*******************************************
' Variables
Symbol RXIN=b0
Symbol N=b1
'*******************************************

Pulsin 3,1, RXIN 'debug RXIN
if RXIN =>150 then goto hipin
if RXIN <150 then goto lopin

Goto main





hipin: high 2
goto main

lopin: low 2
goto main
 

Wrenow

Senior Member
Careful there. According to the manual, Pulsin reads in a Word variable. B0 and B1 are different parts of word variable W0, so you might get some unexpected results. I know I did, until I realized what was going on, and I believe this was the cause of my issues.

Cheers,

Wreno
 
Top