Shop OBEX P1 Docs P2 Docs Learn Events
please help me boebot not moving through wireless — Parallax Forums

please help me boebot not moving through wireless

NoorNoor Posts: 13
edited 2010-01-09 19:54 in Learn with BlocklyProp
Hello, I have a project of rx/tx 434 wireless to send and receive data from PC to the boebot

TX Code:

' {$STAMP BS2}
' {$PBASIC 2.5}
TX PIN 0 ' transmitter
synch CON "A"
Baud CON 16780 ' Baud set at 9600
move·VAR Word
dirChar VAR Word ' Stores directional character

DO
IF (dirChar = "8") OR (dirChar = "w") THEN
GOSUB mission1

ELSEIF (dirChar = "2") OR (dirChar = "x") THEN
GOSUB mission2

ELSEIF (dirChar = "4") OR (dirChar = "a") THEN
GOSUB mission3

ELSEIF (dirChar = "6") OR (dirChar = "d") THEN
GOSUB mission4

ENDIF
LOOP

mission1:
move·= 25011
RETURN
mission2:
move·= 35022
RETURN
mission3:
move·= 45033
RETURN
mission4:
move·= 55044
RETURN
Transmit:
SEROUT 0,baud,[noparse][[/noparse](synch),DEC move]
RETURN
and for Rx:

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

RX PIN 0· ' receiver
synch CON "A" 'This tells the receiver what to expect'
BAUD CON 16780
move·VAR Word
DIRH=%11111111

Start:
SERIN 0,BAUD,[noparse][[/noparse]WAIT(synch),move]
IF move=25011 THEN forward
IF move=35022 THEN backward
IF move=45033 THEN right
IF move=55044 THEN left
GOTO Start

forward:
PULSOUT 12,850
PULSOUT 13,650
PAUSE 20
RETURN

backward:
PULSOUT 12,650
PULSOUT 13,850
PAUSE 20
RETURN

right:
PULSOUT 12,850
PULSOUT 13,850
PAUSE 20
RETURN

left:
PULSOUT 12,650
PULSOUT 13,650
PAUSE 20
RETURN

The programs shows success tokenize
but the boebot is not show any action it is not move, I test the boebot movement and the pins placement but everything is OK even battries are OK
anyone can help me please
thanks


Post Edited (Noor) : 1/6/2010 9:24:25 AM GMT

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-01-06 14:56
    If you transmit a value using the DEC formatter, you have to use the same thing on the receive end:

    SERIN 0,BAUD,[noparse][[/noparse]WAIT(synch),DEC move]

    The SERIN DEC needs some kind of terminating character. Any non-digit will work:

    SEROUT 0,baud,[noparse][[/noparse](synch),DEC move," "]

    Post Edited (Mike Green) : 1/6/2010 3:01:15 PM GMT
  • Beau SchwabeBeau Schwabe Posts: 6,568
    edited 2010-01-06 16:42
    Noor,

    In addition to what Mike said, it also looks like you are sending the WORD variable 'move'. Since the serial commands only operate in BYTEs, you need to use variable descriptors to break down the 'move' WORD variable into BYTEs.

    SERIN 0,BAUD,[noparse][[/noparse]WAIT(synch), move.HIGHBYTE, move.LOWBYTE]
    
    



    SEROUT 0,BAUD,[noparse][[/noparse](synch), move.HIGHBYTE, move.LOWBYTE]
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-01-06 17:07
    What Beau showed is one way to send a 16 bit value between two Stamps. Using DEC at both ends is another way to do the same thing. The technique he showed takes less time to send the data. Using DEC requires more characters (including the terminating non-digit), but can be monitored easily with a display of some sort.
  • NoorNoor Posts: 13
    edited 2010-01-06 19:03
    thanx alot Beau Schwabe and Mike Green
    I will made changes and let you know if anything is wrong
  • NoorNoor Posts: 13
    edited 2010-01-09 14:14
    Mike and Beau is working fine but it is slow
    is there something can do to make it faster
  • Mike GreenMike Green Posts: 23,101
    edited 2010-01-09 14:24
    No

    What do you mean by "slow"?

    What is it doing or not doing?

    What do you mean by "faster"?

    Have you tried making a "sync" pulse as described in the Parallax receiver/transmitter documentation? Does that make any difference?
  • NoorNoor Posts: 13
    edited 2010-01-09 17:45
    I mean it is not moving smoothly or continously
    it needs around 1 sec to to move
    and there is a gap between each move
  • Mike GreenMike Green Posts: 23,101
    edited 2010-01-09 18:47
    Please post your current programs (as attachments ... not cut and paste).

    The way your program was written there's only one set of PULSOUT statements for each data item received and that causes only a single pulse of movement. If it's more than 20ms before the next data item (and it will be), the servos will turn off until the next data item is received thus causing jerky movement. You also should have the "sync" pulse I mentioned.

    You could try reducing the PAUSE times to maybe 15ms, but the movement will still be jerky at times as the two Stamps get out of timing synchronization. For smooth movement, you'll have to redesign and recode your programs.
  • NoorNoor Posts: 13
    edited 2010-01-09 19:45
    here is my program as attachment
    proj 2 is for transmitting
    proj 1 is for receiver
  • Mike GreenMike Green Posts: 23,101
    edited 2010-01-09 19:54
    You have lots of things wrong with both programs ...

    Receive: You can't use RETURN without a GOSUB. That will cause the Stamp to reset. Use "GOTO Start" instead. The DEBUG and PAUSE 1000 statements will slow down the receive program. The DEBUG statement takes several milliseconds and the PAUSE 1000 takes one second.

    Transmit: The DEBUG statement will take a few milliseconds and the PAUSE 50 takes 50 milliseconds. Both will introduce delays.

    As I've mentioned several times, it's helpful to add a synchronization pulse before you send the sync character. Read the documentation on Parallax's 433MHz transmitter / receiver.

    www.parallax.com/Store/Accessories/Communication/tabid/161/CategoryID/36/List/0/Level/a/ProductID/582/Default.aspx?SortField=ProductName%2cProductName
Sign In or Register to comment.