Receive Data from LabView

Hi,
I want to make an LED turn ON and OFF from a Labview Programm.
My Programm is this: Link
With this, i want to send over Port 8888 0 or 1 to my Arduino and he should than write Pin5 HIGH or LOW.

The sketch is:

#include <SPI.h>         // needed for Arduino versions later than 0018
#include <Ethernet2.h>
#include <EthernetUdp2.h>         // UDP library from: bjoern@cs.stanford.edu 12/30/2008

byte mac[] = {
  0x90, 0xA2, 0xDA, 0x10, 0x22, 0xEE
};
//Einstellung MAC adresse //Settings MAC addresse

IPAddress ip(172, 17, 17, 210);
IPAddress gateway(172, 17, 17, 1);
// IP Einsellungen //Ip settings

unsigned int localPort = 8888; 

int Paket; //Variable for the incoming string

EthernetUDP Udp;


int LED = 5; //LED PIN

void setup() {
  SPI.begin(); //Beginne den SPI-Bus 
  digitalWrite(4,HIGH); //SD-Pin 
  Ethernet.begin(mac, ip); //Starte dei IP-Einstellungen 
  Udp.begin(localPort); //Öffne den Port
  pinMode(LED, OUTPUT); //Pin 5 = OUTPUT
  Serial.begin(9600); //Beginne die Serielle Übertragung
}

void loop() 
{
 
Paket = Udp.parsePacket(); //Empfange packet //receive the Packet

  Serial.print(Paket); //Gib im Seriellen Monitor das Packet aus //Write it in the serial Monitor
  Serial.println(); //mach eine nue Zeile im Seriellen Monitor //Make a new heel 
  if(Paket==1) //Wenn du 1 Empängst //if the receive is 1
{

digitalWrite(LED, !digitalRead(LED)); //Änder den LED Status //Change the LED state
delay(50);
while(Paket==1) {
Paket = Udp.parsePacket(); //Warte bis eine etwas !=1 kommt  //whait until Paket isn't 1
}
}
delay(90);
}

In LAbview i can see that the Programm is sending my Value, but the Arduino alwys write 0 in the serial Monitor.

So can't the Arduino receive the datas or can't he unzip them?

int Paket; //Variable for the incoming string

That is NOT what that variable is used for.

Paket = Udp.parsePacket(); //Empfange packet //receive the Packet

The parsePacket() call succeeded, if Paket is 1. That has NOTHING to do with the data that was in the packet.

Paket = Udp.parsePacket(); //Empfange packet //receive the Packet

The parsePacket() call succeeded, if Paket is 1. That has NOTHING to do with the data that was in the packet.

Checks for the presence of a UDP packet, and reports the size. parsePacket() must be called before reading the buffer with UDP.read().
^^ mistaken with read

so Udp.parsePacket(); says me how big the the data in the buffer is. With read i can take the data out the buffer., but how do the data get in the buffer? Are they written from the LabView Programm in the buffer?

but how do the data get in the buffer?

Something sent a UDP packet. That something made the data available for parsePacket() (stupid name) to copy to a buffer. parsePacket() then tells you how much data is in the buffer, and read() gets the data from the buffer into your array.

Something sent a UDP packet. That something made the data available for parsePacket() (stupid name) to copy to a buffer. parsePacket() then tells you how much data is in the buffer, and read() gets the data from the buffer into your array.

Thanks, for this explanation.
The Sketch is now Working as i want

[code]
#include <SPI.h>         // needed for Arduino versions later than 0018
#include <Ethernet2.h>
#include <EthernetUdp2.h>         // UDP library from: bjoern@cs.stanford.edu 12/30/2008

byte mac[] = {
  0x90, 0xA2, 0xDA, 0x10, 0x22, 0xEE
};
//Einstellung MAC adresse //Settings MAC addresse

IPAddress ip(172, 17, 17, 210);
IPAddress gateway(172, 17, 17, 1);
// IP Einsellungen //Ip settings


char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; //save the data
int Paket;  //Variable to save the size of the data

EthernetUDP Udp;  //use UDP


int LED = 5; //LED PIN

void setup() 
{
  SPI.begin(); //Beginne den SPI-Bus 
   digitalWrite(4,HIGH); //SD-Pin 
    Ethernet.begin(mac, ip); //Starte dei IP-Einstellungen 
     Udp.begin(8888); //Öffne den Port
      pinMode(LED, OUTPUT); //Pin 5 = OUTPUT
       Serial.begin(9600); //Beginne die Serielle Übertragung 
         //Start the serial Monitor
}

void loop() 
{
 Paket = Udp.parsePacket(); //Empfange packet //receive the Packet
  if(Paket)
 {
   Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE); //read the data
    String stringOne =  String(1);  //create String from 1
     Serial.println("Contents:");
      Serial.println(packetBuffer);
       if(stringOne.equals(packetBuffer))
       //show if the data from the buffer and stringOne are equal
  {
  int a = digitalRead(5);  //read the Value from Pin 5
    if(a==HIGH) {digitalWrite(5, LOW);} //Changethe Value from Pin 5
    if(a==LOW) {digitalWrite(5, HIGH);} //Change the Value from Pin 5
  }
    
  for(int c=0;c<UDP_TX_PACKET_MAX_SIZE;c++) //erase buffer
   {
   packetBuffer[c] = 0;  
   }
   }

delay(90);
}

[/code]