Go Down

Topic: read data from 2 pins of ardunio and use it in LABVIEW (Read 1 time) previous topic - next topic

hello reader!
i have seen quite a few ppl read one pin using ardunio and displaying it in labview ...but is it possible to read 2 pins from the ardunio board and display their value in labview...if so, can u pls tell me how to do it and if someone has tried such thing can u pls send me the file.
thanks to all!

Grumpy_Mike

Quote
is it possible to read 2 pins from the ardunio board and display their value in labview.

Yes, lots of ways. Here is one:-
Two pins are just two bits so combine them like this
VlauetoSend = 0x30 | digitalRead(onePin) | (digitalRead(otherPin) <<1);
This generates an ASCII character of 0, 1, 2 or 3 depending on what the value on the two pins are.

madworm

Use the search function my friend! It has been talked about before.

And if you don't find it, use serial I/O with VISA (if that is still available in LV 8 - or whatever the version number happens to be today). There are VIs to set up the com port and equivalents to the .available() and .print() methods. Quite simple.
• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

ya thax for the info but am new to the forum and completly new with interfacing labview and arduino
Quote
There are VIs to set up the com port and equivalents to the .available() and .print() methods

can u share with me how it is done .

thax for the info mike!

Two pins are just two bits so combine them like this
VlauetoSend = 0x30 | digitalRead(onePin) | (digitalRead(otherPin) <<1);
This generates an ASCII character of 0, 1, 2 or 3 depending on what the value on the two pins are.

but i do not understand how this works ...it would be really helpfull if u could pls explain to me how it would work .

madworm

#5
Oct 19, 2011, 04:58 pm Last Edit: Oct 19, 2011, 05:04 pm by madworm Reason: 1
Well... first take a look at the arduino examples. There is one that sends some data over the serial port. It is quite simple. Modify it so it sends something trivial, let's say a single letter like 'X'. You can check if it works with the IDE's serial monitor.

Then start labview, navigate to the example section and try to find Serial I/O. There's got to be an example. There were simple examples in LabView 7, so I doubt they removed those. Play with it. You know that it should receive the letter 'X'.

The best way to get started is learning by doing. Just reading manuals and looking at code won't do. I think I posted an image of the 'backplane' of some labview code that reads data from an arduino in the old forum. You should be able to find it. Search for 'Labview 7.0 Student edition' ;-)
• Upload doesn't work? Do a loop-back test.
• There's absolutely NO excuse for not having an ISP!
• Your AVR needs a brain surgery? Use the online FUSE calculator.
My projects: RGB LED matrix, RGB LED ring, various ATtiny gadgets...
• Microsoft is not the answer. It is the question, and the answer is NO!

Grumpy_Mike

Quote
but i do not understand how this works

Not sure how to answer that because that single line is how it works. That makes up an ASCII character that depends on the state of your input pins. To send that to labview all you need to do is to print it:-
Serial.print(ValueToSend, BYTE);
The labview will pick up a value from the serial port and that value will reflect the state of the two pins.

Once you have the receiving end going like madworm told you replace the sending X with the line I gave.

Go Up