Shop OBEX P1 Docs P2 Docs Learn Events
BS2 Select Case problem, via Blue tooth serial conection — Parallax Forums

BS2 Select Case problem, via Blue tooth serial conection

Rob311Rob311 Posts: 83
edited 2007-02-27 17:32 in BASIC Stamp
Im working on a project where I read in the data from a serial connection and run it into an select case.
For some reason I cant get it to work, keeps telling me “else”

Here is the code, or at least a snippet of it


szData VAR Byte(10) 'Bluetooth serial in

Recive:
'==BT recive== (im using a Bluetooth unit so I display it on my lcd, for debugging purposes
SEROUT lcdpin, baud19200, [noparse][[/noparse]12] 'clear
SEROUT lcdpin, baud19200, [noparse][[/noparse]"Bluetooth Control"]

'serin pin,baud,[noparse][[/noparse]STR var\how many]
SERIN 0,84,[noparse][[/noparse]STR szData\10\CR] ‘<=this is where is store the serial in data

'==Display Input==
SEROUT lcdpin, baud19200, [noparse][[/noparse]12] 'clear
SEROUT lcdpin, baud19200, [noparse][[/noparse]STR szData\10] ‘<= I show it here on my lcd no problem
PAUSE 1000 'pause to read

'==Switch Case==
SELECT szData
CASE 0000000001
SEROUT lcdpin, baud19200, [noparse][[/noparse]12] 'clear
SEROUT lcdpin, baud19200, [noparse][[/noparse]"Case 0"]

CASE 0 TO 1
SEROUT lcdpin, baud19200, [noparse][[/noparse]12] 'clear
SEROUT lcdpin, baud19200, [noparse][[/noparse]"Case 1"]

CASE 1 TO 2
SEROUT lcdpin, baud19200, [noparse][[/noparse]12] 'clear
SEROUT lcdpin, baud19200, [noparse][[/noparse]"Case 2"]

CASE ELSE ' invalid command
SEROUT lcdpin, baud19200, [noparse][[/noparse]12] 'clear
SEROUT lcdpin, baud19200, [noparse][[/noparse]"Case Else"]
PAUSE 1000 'read time
ENDSELECT


GOTO recive

I really hope there’s a nice quick answer to this..

Thanks!
Rob

Comments

Sign In or Register to comment.