LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

sending variable from labview to the arduino

Hello all,

I'm trying to send some variables back from the labview to the arduino with no success till now.

I tryed to add new case for the sketch of the arduino interface and send value via the send receive Vi.

no responding.

I will be very happy if anyone can help.

Sketch add in the cases:

       case 0x1E: // test case

       pinMode(12,OUTPUT);

       digitalWrite(12,HIGH);  // indicate if execute

       Setpoint[command[1]]==700; // just try to give new value

       Serial.write( byte(0) );

        break;

     

       case 0x1F: // test case

         pinMode(0,OUTPUT);

         digitalWrite(12,LOW); // indicate if execute

         Setpoint[command[1]]==200;  // just try to give new value

         Serial.write( byte(0) );

          break;

0 Kudos
Message 1 of 3
(4,146 Views)

Hey hraanan,

Looking at the write digital pin as an example:

case 0x03:    // Write Digital Pin

      digitalWrite(command[2], command[3]);   //Write out on the pin specified at command[2] the value at command[3]

      Serial.write('0');  //Write a confirmation back to LabVIEW

      break;

In this example you would set the Send/Receive in LabVIEW to expect 1 byte.  You need to pass Send/Receive the command byte first followed by as many data bytes as you want.

In the code you provided I am not sure what you are trying to do with this line: Setpoint[command[1]]==200;  // just try to give new value

To use the value you send to the Arduino board I would expect you to want something like Setpoint =command[2];

Post back if you have any questions.

Kevin Fort
Principal Software Engineer
NI
0 Kudos
Message 2 of 3
(2,886 Views)

hraanan,

Were you able to accomplish this task? If so, would you post the solution?

I am trying to do something similar.

Thanks

CLD Certified 2014
0 Kudos
Message 3 of 3
(2,886 Views)