10-17-2012 05:33 AM
hello, iam a noob in Labview and also Arduino, but i try to learn it step by step, Currently i have a problem on how to creating communication between labview and arduino using Xbee so that in the end of this small project, i able to control one or more servo from the labview. I've tried several tips from discussions in this forum, the last post i was looking at is https://decibel.ni.com/content/thread/10814, but nothing can seem clearly make me through it. I'm using Arduino Uno, Xbee 1mw and i already got these xbees communicating to each other with xctu. When i try to connect it up, the xbee keeps sending data (lights DIn Dout flashing constantly), but the LED seems not responding to the data i sent.
This is the block diagram,
i also have already changed the LabVIEWInterface.h so that the default BAUDRATE only appointed to 9600
If anyone kind to help me, i would appreciate it so much, Thanks!
10-17-2012 06:29 PM
Is the Arduino showing as registered to a port in the device manager? Also, the default baudrate for the Uno is not 9600, it is 115200.
10-20-2012 12:01 AM
ya, for sure it is already registered, i've tried to change its baudrate, but nothing seems working. Previously, i have successfully connect the arduino and xbee that i can manually control one or more servo with X-CTU. And i also can control one or more servo within a dial in labview but this is when i directly connect the arduino to the computer and without xbee.
When using xbee it appears that i have error 5002, the labview could not initiate the arduino connection or something, but after i start the labview code that i've shown previously, the red led in both xbee explorer and xbee shield is flashing rapidly. Do i miss something? the image below show when i tried rotate a 180 servo with labview using xbee, but nothing seems working..
Thanks all
10-20-2012 01:30 AM
Are you using the "abort execution" button to stop your program?
10-20-2012 10:56 AM
ya, Im using the stop button to stop the program whenever it is not working. is it related to the error i've got? or is it something have to do with the xbee communication in labview? errgh, this has spins my head around for days..
10-20-2012 01:07 PM
Generally, with LIFA, you never use the "Abort Execution" button because it can cause this error. So, always use the "Stop" button in the while loop to stop code that is using LIFA. If for some reason that won't work, then all you can do is abort but then you have to consider that the Arduino was not closed successfully and that you might have this issue.
Does it ever connect successfully to the Arduino, like when you first start LabVIEW and connect everything?
10-20-2012 05:25 PM
yaph, get it, thanks for the info for not using abort execution button that sometimes it leads to unsuccessfully closed arduino. Okay, right from the first time i using xbee in Labview, it never connect successfully to Arduino (its just showing rapidly flashy red led in xbee explorer), but if it is without xbee, everything work just fine, is it something to do with setting up the xbee in LabVIEW? do you have any starting tutorial references related to this?
Thanks
10-20-2012 06:08 PM
hola amigo como pudiste ya que no he podido realizar esta conexion podrias subir una imagen con el codigo para verificar los errores que pueda tener en mi VI saludos
10-21-2012 03:13 AM
Halo Nathan, i finally get it worked. I did,
1. changed the defaultbaudrate in LabviewInterface.h
so it becomes (remove the if else),
#define DEFAULTBAUDRATE 9600 // Defines The Default Serial Baud Rate (This must match the baud rate specifid in LabVIEW).
2. creating control for connection type pointing to xbee and create constant for baud rate (9600) and creating constant for visa resources
This is the final code i get,
and that's all, everything from the previous thread i referring was actually right, it was me that is not rigorous and aware of this. Thanks for your help!
10-21-2012 01:23 PM
Sometimes the smallest issues are the hardest to "fix". lol I'm glad you figured it out!