Go Down

Topic: Read and INT value in Labview (Read 489 times) previous topic - next topic

ctuna

Hi!
I am working on a proyect with a Ping))) Sensor, an arduino duemilanove and labview.
Right now I am stuck because the distance measurement from the ping))) is stored in a INT value, and I don't have any clue about how I can read this varible in Labview, in the Arduino I am loading the Lifa base file mixed with Ping))) sensor example that came with Arduino IDE that is working fine as I am still able to read the data trought Arduino IDE option Monitor Serial, in Labview I am using the examples to use with Arduino but I have none related experience with both softwares.
Most of the examples out there are about reading and analog pin and graph it in Labview but that doesn't work for me
Any help will be appreciated.
Regards

PS If you need me to upload any of the software or code I am able to do it so.
PS2 I apologize for my English as is not my native language

robtillaart

an int should be send as 2 bytes

Code: (sending site) [Select]
int value = ...
byte b1 = value / 256;
byte b2 = value % 256;
serial.write(b1);  // notice write iso print
serial.write(b2);


on the receiving site you need to merge the 2 bytes again

Code: (receiving site) [Select]
int value = readbytefromserial() * 256;
value = value + readbytefromserial();


got the idea?


Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up