ColorPal doubt
fbozzo
Posts: 6
Hi everyone, am I new to the forum and I have a doubt about ColorPal sensor. After reading ColorPal´s datasheet I understand that the following command will perform a RGB reading (subtracting ambient light):
SEROUT sio, baud, ["= (00 $ m) !"]
But I don´t understand how should I receive data from sensor. Should I wait for character $ to arrive and then data? How many bytes will the sensor send to the microcontroler?
I will be pleased if you help me.
Regards
SEROUT sio, baud, ["= (00 $ m) !"]
But I don´t understand how should I receive data from sensor. Should I wait for character $ to arrive and then data? How many bytes will the sensor send to the microcontroler?
I will be pleased if you help me.
Regards
Comments
Welcome to the Parallax forum! Let's break that line down into its component parts:
= Begin a program sequence.
(00 Start an infinite (since the count is zero) loop.
$ Send a dollar sign character. Any character that's not a command is sent as-is.
m Perform a multi-color acquisition, subtract the ambient light reading form each component, and transmit the data as nine hex digits in the order RRRGGGBBB
) End the loop.
! Begin execution of the program sequence. This starts the loop, which outputs $RRRGGGBBB$RRRGGGBBB$RRRGGGBBB... continuously.
So, to answer your question, you wait for a dollar sign ($), then read three 3-digit hexadecimal numbers.
-Phil
SEROUT sio, baud, ["= $ m !"] or
SEROUT sio, baud, ["= (01 $ m) !"]
I think the first one is more convenient because a one-time loop has not sense. But am I not sure about syntax.
Regards,
-Phil
Regards,
http://forums.parallax.com/showthread.php?118435-ColorPAL-Object-and-ColorPAL-VGA-Demo&highlight=colorpal
Regards,
Regards,
-Phil
Regards,