Shop OBEX P1 Docs P2 Docs Learn Events
bs2p40 and cmucam — Parallax Forums

bs2p40 and cmucam

ArchiverArchiver Posts: 46,084
edited 2004-05-11 14:42 in General Discussion
Sorry for the message mess i am causing. Unfortunately scattering
DEBUGs around in the program (as I mentioned my previous message)
didnt work for the following program. Which means I should thoroughly
figure out how SERIN and SEROUT commands work with BS2p40. The last
code is at the bottom of the page. Thanks very much...

Murat



'
'{$STAMP BS2p}
'{$PBASIC 2.5}

' CMUcam Demo Program 2

RcvData VAR Byte(10)

PAUSE 1000

SEROUT 10, 240, [noparse][[/noparse]"RS", CR]
SERIN 9, 240, [noparse][[/noparse]WAIT (":")]
PAUSE 1000


SEROUT 10, 240, [noparse][[/noparse]"L1 1",CR]
SERIN 9, 240, [noparse][[/noparse]WAIT (":")]
PAUSE 100


SEROUT 10, 240, [noparse][[/noparse]"CR 18 44",CR]
SERIN 9, 240, [noparse][[/noparse]WAIT (":")]
PAUSE 100

PAUSE 5000

SEROUT 10, 240, [noparse][[/noparse]"CR 18 44 19 32",CR]
SERIN 9, 240, [noparse][[/noparse]WAIT (":")]
PAUSE 100

SEROUT 10, 240, [noparse][[/noparse]"L1 2",CR]
SERIN 9, 240, [noparse][[/noparse]WAIT (":")]
PAUSE 100

PAUSE 5000

SEROUT 10, 240, [noparse][[/noparse]"PM 1",CR]
SERIN 9, 240, [noparse][[/noparse]WAIT (":")]
PAUSE 100

SEROUT 10, 240, [noparse][[/noparse]"RM 3",CR]
PAUSE 100


SEROUT 10, 240, [noparse][[/noparse]"TW",CR]
SERIN 9, 240, [noparse][[/noparse]STR RcvData\8]


DEBUG "Red Mean ",DEC RCVData(2) ,CR
DEBUG "Green Mean ",DEC RCVData(3) ,CR
DEBUG "Blue Mean ",DEC RCVData(4) ,CR
DEBUG "Red Deviation ",DEC RCVData(5) ,CR
DEBUG "Green Deviation ",DEC RCVData(6) ,CR
DEBUG "Blue Deviation ",DEC RCVData(7) ,CR
DEBUG " ", CR

PAUSE 2000

Main:

PAUSE 1000

SEROUT 10, 240, [noparse][[/noparse]"TC",CR]
SERIN 9, 240, [noparse][[/noparse]STR RcvData\10]

' Display all returned camera M Track Color packet data to PC debug
screen

DEBUG "Middle Mass X ",DEC RCVData(2) ,CR
DEBUG "Middle Mass Y ",DEC RCVData(3) ,CR
DEBUG "Left Corner X ",DEC RCVData(4) ,CR
DEBUG "Left Corner Y ",DEC RCVData(5) ,CR
DEBUG "Right corner X ",DEC RCVData(6) ,CR
DEBUG "Right Corner Y ",DEC RCVData(7) ,CR
DEBUG "Pixels ",DEC RCVData(8) ,CR
DEBUG "Confidence ",DEC RCVData(9) ,CR
DEBUG " ", CR

GOTO Main
Sign In or Register to comment.