Serial connection with LabVIEW

Hey everyone. I'm trying to create a simple serial connection to get my Arduino Uno to communicate with LabVIEW. I'm trying to turn an LED on and off through the LabVIEW program. I've written a VI that sends either a 0 or 1 to the board, however the LED does not respond. Is there a problem with my sketch?

int ledPin = 3;

void setup() { Serial.begin(9600); pinMode(ledPin, OUTPUT); }

void loop() { int serialReading = 0; serialReading = Serial.read(); if (Serial.available() > 0) { serialReading = Serial.read(); digitalWrite(ledPin,HIGH);

}

else { }

}

Thanks.

Some simple test code that will turn the LED on the arduino board on and off.

// zoomkat 8-6-10 serial I/O string test
// type on or off in serial monitor. then send or enter
// for IDE 0019 and later

String readString;


void setup() {
    Serial.begin(9600);
        pinMode(13, OUTPUT);
        Serial.println("serial test 0021"); // so I can keep track of what is loaded
        }

void loop() {

        while (Serial.available()) {
        delay(1);  
      char c = Serial.read();
        readString += c; 
        }
        
      if (readString.length() >0) {
      Serial.println(readString);
     
    if (readString == "on") {
    digitalWrite(13, HIGH);
        Serial.println("Led On");
    }
   if (readString == "off") {
    digitalWrite(13, LOW);
        Serial.println("Led Off");
    }
        readString="";
   } 
}

modded your code

int ledPin = 3;

void setup()
{
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT); 
}
   
void loop()
{
  char c = 0;
  if (Serial.available() > 0) 
  {
    c = Serial.read();
    if (c == '1')     // assuming you send character '1', not a byte with value 1 
    {
       digitalWrite(ledPin, HIGH);
    }
    if (c == '0')
    {
       digitalWrite(ledPin, LOW);
    }
  }
}