Pages: [1]   Go Down
Author Topic: Read and INT value in Labview  (Read 467 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 227
Posts: 14048
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

an int should be send as 2 bytes

Code: (sending site)
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)
int value = readbytefromserial() * 256;
value = value + readbytefromserial();

got the idea?
 

Logged

Rob Tillaart

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

Pages: [1]   Go Up
Jump to: