|
SSC-32 and reading Analog Sensor via Serial Module from Australia [2 posts] |
15 year
|
Hi,
Can someone please help me out with this one. I am having real trouble reading analog sensor properly with Serial module. I have read the documentation and other forum post but just cannot get my RR to read sensor properly.
I am using SSC-32 and Sharp GP2D12 IR Sensor plugged into input D.
It seems that it does read the variable when its some random letters but does not seem to read it when it number that represents the distance.
I have included the file and picture of how it does not display the variable.
Where am I going wrong?
Thanks,
Milan
program.robo
|
|
|
Anonymous |
15 year
|
Milan,
I'm assuming the SSC module didn't work in acquiring the inputs (most like due to the lack of initialization).
When using the serial module you can use a single \ (slash) to specify that the receive data is a single byte to be placed into the specified variable. In the case of just specifying the variable the serial module does not know how much info you want to read into the variable before placing that data in it. Try a single slash for 1 byte and a double slash for 4 bytes. These are typically used when a number is being sent back from the device.
STeven.
|
|
|
from Australia [2 posts] |
15 year
|
STeven,
It works perfect now.
Thanks,
Milan
|
|