Shop OBEX P1 Docs P2 Docs Learn Events
ASAP, trying to control a RC??? — Parallax Forums

ASAP, trying to control a RC???

Sam01Sam01 Posts: 1
edited 2007-12-09 17:30 in BASIC Stamp
Hi everyone, I need help on this, for Monday,

I have a RC car, and was able to break into the connection and control how fast the car go, by doing this:

·FOR i = 1 TO 1000
··· HIGH 0
··· PAUSE 10
··· LOW 0
··· PAUSE 25
·NEXT

My only problem is that i want to the car to go this speed only when it receives a signal from the Transmitter, if there is no transmitter, go full speed·, so far i have this:

DO
LOW 0
SERIN 7, 16468, [noparse][[/noparse]WAIT("!"), x.HIGHBYTE, x.LOWBYTE ]
HIGH 0

DEBUG ? x
IF (x = 25 )· THEN

FOR i = 1 TO 1000
··· HIGH 0
··· PAUSE 10
··· LOW 0
··· PAUSE 25
·NEXT
ELSE

FOR i = 1 TO 1000
··· HIGH 0
··· PAUSE 100
··· LOW 0
··· PAUSE·5
·NEXT

ENDIF
LOOP

Thanks in advance!!!

Comments

  • BladersBladers Posts: 8
    edited 2007-12-09 17:30
    after looking at your code i see that full speed is...
    FOR i = 1 TO 1000
    ··· HIGH 0
    ··· PAUSE 100
    ··· LOW 0
    ··· PAUSE·5
    ·NEXT


    and the custom defined speed is...
    ·FOR i = 1 TO 1000
    ··· HIGH 0
    ··· PAUSE 10
    ··· LOW 0
    ··· PAUSE 25
    ·NEXT


    I·think i see·the solution, try this code....
    add x = 0 after ENDIF

    The problem was if no transmission came x will still be 25 from the last transmission, so you need to set it to 0 before using it agian.
Sign In or Register to comment.