Shop OBEX P1 Docs P2 Docs Learn Events
Control BOE-BOT using RF receiver from RC models at 72 MHz Band — Parallax Forums

Control BOE-BOT using RF receiver from RC models at 72 MHz Band

Chris GeorgiadisChris Georgiadis Posts: 5
edited 2008-02-12 21:18 in Robotics
I purchase my boe-bot last week and started imidiatly to working with it.
So resume all my parts that i have from my RC airplane (servos, RF control e.t.c.) and started to compile a robot that can be controled trouhg RF and to be autonomus too.

Since now after searcing the forum i made a code that working the RF remote control, and now searching how to make it autonomous too.

I don't know the Pbasic much well so i need some help here.

I provide the code for the RF and i will help for: How to combine the irRoaming.bs2 in it.

Thank you.



' {$STAMP BS2}
' {$PBASIC 2.5}

Pulse PIN 5 ' pulse input pin for forward - backward
Pulsesteer PIN 6 ' pulse input pin for steering
pulseCount VAR Byte ' pulse received from RF transmiter

#SELECT $STAMP
#CASE BS2, BS2E, BS2PE
Scale CON $200 ' 2.0 us per unit
#CASE BS2SX, BS2P
Scale CON $0CC ' 0.8 us per unit
#CASE BS2PX
Scale CON $0CF ' 0.81 us per unit

#ENDSELECT

time VAR Word

Main:
PULSIN Pulse, 1, time ' measure positive pulse
IF (time > 0) THEN ' if not 0
DEBUG HOME,
DEC time, " units ", CLREOL ' display raw input
time = time */ Scale ' adjust for Stamp
DEBUG CR,
DEC time, " us " ' display microseconds
ELSE
DEBUG CLS, "Out of Range" ' else error message
ENDIF
PAUSE 200
PULSIN Pulse, 1, time ' measure positive pulse
IF (time > 760) THEN ' when the stick is in middle position you get variable time (normal is 750) so left a gap about 10
GOSUB Forward_Pulse
HIGH 1
ELSE
LOW 1
ENDIF
IF (time < 740) THEN
GOSUB Back_Up
HIGH 10
ELSE
LOW 10
ENDIF

Main2:
PULSIN Pulsesteer, 1, time ' measure positive pulse
IF (time > 0) THEN ' if not 0
DEBUG HOME,
DEC time, " units ", CLREOL ' display raw input
time = time */ Scale ' adjust for Stamp
DEBUG CR,
DEC time, " us " ' display microseconds
ELSE
DEBUG CLS, "Out of Range" ' else error message
ENDIF
PAUSE 200
PULSIN Pulsesteer, 1, time ' measure positive pulse
IF (time > 760) THEN
GOSUB Turn_Left
ENDIF
IF (time < 740) THEN
GOSUB Turn_Right
ENDIF
GOTO Main
END


Forward_Pulse: ' Send a single forward pulse.
FOR pulseCount = 0 TO 20
PULSOUT 13,850
PULSOUT 12,650
PAUSE 20
NEXT
RETURN

Turn_Left: ' Left turn, about 90-degrees.
FOR pulseCount = 0 TO 20
PULSOUT 13, 650
PULSOUT 12, 650
PAUSE 20
NEXT
RETURN

Turn_Right:
FOR pulseCount = 0 TO 20 ' Right turn, about 90-degrees.
PULSOUT 13, 850
PULSOUT 12, 850
PAUSE 20
NEXT
RETURN

Back_Up: ' Back up.
FOR pulseCount = 0 TO 20
PULSOUT 13, 650
PULSOUT 12, 850
PAUSE 20
NEXT
RETURN
Sign In or Register to comment.