please help me boebot not moving through wireless
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
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
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
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.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe
IC Layout Engineer
Parallax, Inc.
I will made changes and let you know if anything is wrong
is there something can do to make it faster
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?
it needs around 1 sec to to move
and there is a gap between each move
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.
proj 2 is for transmitting
proj 1 is for receiver
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