Is there anyway to display text on serial display while running servo?
hmiller
Posts: 17
Hi,
I want to know if there is any way to display text on a backlit display (#27977), while running a servo. When I go to run my servo the display goes out and then the display comes back on after the servo is done rotating its cycle. I want it so that my lcd displays text while the servo is running.
Here's my code:
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG ? IN1
counter VAR Word
IF IN1 = 0 THEN
DEBUG "Vending...", CR
FOR counter = 1 TO 150
PULSOUT 2, 1000
PAUSE 20
NEXT
SEROUT 15, 84, [17, 22]
SEROUT 15, 84, ["vending..."]
SEROUT 15, 84, [12]
SEROUT 15,84, ["Thank you!"]
DEBUG "Thank you!", CR
SEROUT 15, 84, [12]
ENDIF
I want to know if there is any way to display text on a backlit display (#27977), while running a servo. When I go to run my servo the display goes out and then the display comes back on after the servo is done rotating its cycle. I want it so that my lcd displays text while the servo is running.
Here's my code:
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG ? IN1
counter VAR Word
IF IN1 = 0 THEN
DEBUG "Vending...", CR
FOR counter = 1 TO 150
PULSOUT 2, 1000
PAUSE 20
NEXT
SEROUT 15, 84, [17, 22]
SEROUT 15, 84, ["vending..."]
SEROUT 15, 84, [12]
SEROUT 15,84, ["Thank you!"]
DEBUG "Thank you!", CR
SEROUT 15, 84, [12]
ENDIF
Comments
In the code you've posted, it only executes once. Is that what you want? There's nothing written to the LCD before you do the servo movement. You'll get the servo movement, then the "vending.." message, the display will clear, then "Thank you!", then the display will clear again and the Stamp will stop.
The LCD documentation shows how to position the cursor to a specific position. You'll have to center data by yourself by figuring out how many characters you plan to display on a line, subtracting that from the size of the LCD and dividing that in half to get the starting column number.
'
Take a look in the Basic Stamp Syntax manual for the different Baud rates.The values very from one Stamp family to another.
'
http://www.parallax.com/Store/Books/BASICStamp/tabid/168/CategoryID/42/List/0/SortField/0/Level/a/ProductID/143/Default.aspx
'
A free download (pdf)
Check the table 5.107 on page 419 of the basic stamp manual.
An 84 is the baud mode for 9600 bps, 8 bit, no parity, True (non-inverted) configuration for a BS2.