Shop OBEX P1 Docs P2 Docs Learn Events
BS2 and RC car Receiver — Parallax Forums

BS2 and RC car Receiver

Miles. kMiles. k Posts: 34
edited 2010-01-11 18:56 in BASIC Stamp
i do believe i posted something like this before but when i posted it, it wasn't very descriptive.

What im trying to do is have a Receiver for a Futaba Pistol grip controller connected to pin 15 on a BS2 and
then display the "duration" in the debug terminal so i can use it for a pulsout command for a HB25. the code i have is very simple but it doesn't work.....right.

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

time VAR Word

DO
PULSIN 15, 1, time
DEBUG HOME, time
LOOP

when i run the program and i pull the trigger on the controller it displays odd things like:

Comments

  • Casey GrossCasey Gross Posts: 14
    edited 2010-01-01 02:55
    it sounds like the controller uses a potentiometer; an rctime is what you should use to get the readings your looking for.

    Post Edited (Casey Gross) : 1/1/2010 3:02:36 AM GMT
  • Miles. kMiles. k Posts: 34
    edited 2010-01-01 03:50
    i tried this:

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

    time VAR Word

    DO
    RCTIME 15, 1, time
    DEBUG HOME, time
    LOOP

    but it doesn't seem to work because it still displays those weird little symbols when i try it
  • skylightskylight Posts: 1,915
    edited 2010-01-01 10:52
    try

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

    time VAR Word

    DO
    RCTIME 15, 1, time
    DEBUG HOME, DEC time
    LOOP
  • Miles. kMiles. k Posts: 34
    edited 2010-01-01 18:50
    i tried that and now it displays numbers but.....they only change while there moving.

    example: if the joystick was in the all the way down position, it would display "138" in the debug terminal, when i move the joystick to the up position in a fast movement..then numbers would get higher (139,150,160,ect.) but as soon as i stop moving the joystick the number in the debug terminal would go straight to "138".

    thanks,
    miles. K
  • Miles. kMiles. k Posts: 34
    edited 2010-01-01 19:01
    WAIT i fixed it. all i had to do was switch out "RCTIME" for "PULSIN" and now it works great. but can anyone figure out how to combine this knowledge with 2 HB25's.

    would it be like:

    IF 15 > 750
    THEN GOSUB forward
    IF 15 < 750
    THEN GOSUB backwards

    Thanks,
    Miles. K
  • skylightskylight Posts: 1,915
    edited 2010-01-02 20:17
    sounds like you are almost there,now read the documentation for the HB25
  • FranklinFranklin Posts: 4,747
    edited 2010-01-03 05:36
    Don't the HB25's take servo commands in and doesn't the futaba put servo commands out?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Miles. kMiles. k Posts: 34
    edited 2010-01-10 18:19
    yes but my robot has tank treads so if i want to turn.........
  • W9GFOW9GFO Posts: 4,010
    edited 2010-01-11 18:56
    I would think that what you want to do is read the pulses on two channels, the throttle channel and the steering channel. So that would require two PULSIN commands, each on a different pin with each value stored in an appropriate variable. Then, you need need two PULSOUT commands, one for each HB25.

    Something like;

    PULSIN 15, ThrottleChannelValue
    PULSIN 16, SteerChannelValue

    PULSOUT Left_HB25, (ThrottleChannelValue + (750 - SteerChannelValue)) MAX 1000
    PULSOUT Right_HB25, (ThrottleChannelValue - (750 - SteerChannelValue)) MIN 500

    Rich H

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    The Simple Servo Tester, a kit from Gadget Gangster.
Sign In or Register to comment.