1

I have already downloaded the arduino package for LabVIEW, MakerHub LINX, NI-Visa, and I've uploaded LIFA_Base to arduino, and it still does not work :(. My questions are:

1) Do I need to upload the LIFA_Base to arduino every time I want to interface arduino with LabVIEW, or is once enough? (the order I'm following is: upload LIFA_Base -> upload my arduino code -> run the LabVIEW code)

2) I know my arduino UNO is receiving info by the LabVIEW software because the RX led goes on every time I press the ON/OFF buttons, what could be the problem?

The ideia of this humble project is to turn on/off LED through the LabVIEW. The arduino code follows the LebVIEW code. enter image description here

String c, string;
int led = 2;

void setup() {
   Serial.begin(9600);
}

void loop() {
   if (Serial.available() > 0) string = "";

   while(Serial.available() > 0)
   {
     c = (byte)Serial.read();
       if (c == ":")
       {
         break;
       }else
       {
         string += c;
       }
     delay(1);
   }

   if (string == "LL")
   {
     digitalWrite(led, HIGH);
   }
   if (string == "DL")
   {
     digitalWrite(led, LOW);
   } 
}

migrated from electronics.stackexchange.com Sep 20 '16 at 1:00

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

  • Long time LabVIEW and Arduino user, but never used LIFA. I did a quick look at the getting started for LIFA. If I'm not mistaken, do you even need to upload your own Arduino code? Doesn't the LIFA_Base.pde take care of the interpretation of these serial commands for you, or am I totally missing something? – alexwarrior Sep 19 '16 at 23:16
  • I have just started to combine arduino with LabVIEW, so I have no experience to tell if you are actually missing something. How did you use to work with arduino and LabVIEW? Because I think I am mixing up different ways to do the same thing and that's why it's not working. Did you use the arduino elements from LabVIEW or just the VISA ones? Thanks!! – Vinícius Lopes Simões Sep 19 '16 at 23:26
  • I've personally always just used VISA elements, and then wrote Arduino code similar to like what you have above. But the LIFA elements look like they would be easier to get started with! And for that I'm pretty sure you just want to upload LIFA_Base.pde to the arduino. – alexwarrior Sep 19 '16 at 23:30
  • From the LabVIEW side of things, I would just go with an event structure and use a single boolean to control the LED - let it go idle when the button state has not changed. No need to poll! – Adam Lawrence Sep 20 '16 at 2:15
  • upload LIFA_Base -> upload my arduino code”. You can only have one program in the Arduino at a time. When you upload your Arduino code, you are overwriting the previously uploaded LIFA_Base. – Edgar Bonet Sep 20 '16 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.