LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView Arduino Led Control

Hi

I need to control 3 Led with Labview over Arduino.But i cannot figure out i made 1 Led control how can i add 2 more Led on this Arduino code and Labview vi.

Thank you

 

My Arduino Code.

 

int led;
void setup() {
Serial.begin(9600);
pinMode(13, OUTPUT);
}
void loop() {
if(Serial.available ()> 0)
{
led = Serial.read ();
if (led == '1')
{
digitalWrite (13,1);
}
else if (led == '0')
{
digitalWrite (13,0);
}
}
}

 

0 Kudos
Message 1 of 2
(2,589 Views)

Hi OmrFV,

 

you need to define more/other commands to send from LabVIEW to your Arduino.

 

You might:

  • use an integer number and encode the LED states in the bits of that integer, like 0=all off, 5=LED1&LED3 on…
  • use a string of 3 chars to control 3 LED, like "000" all off, "101" LED1&LED3 on…
  • use separate commands for each LED, like "LED1=0;LED2=1;LED3=1"…
  • any other idea you get…
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 2
(2,582 Views)