06-04-2019 08:32 AM - edited 06-04-2019 08:33 AM
Hi,
I use the same VI like in the solution but I changed the Arduinocode. Now my Arduino prints everything what I've ever written in the LabVIEW program.
#include <SPI.h> #include <Ethernet.h> byte mac[] = {0x90, 0xA2, 0xDA, 0x00, 0x59, 0x67}; //adresse mac de la carte IPAddress ip( 169, 254, 155, 2 ); IPAddress gateway( 169, 254, 155, 1 ); IPAddress subnet( 255, 255, 255, 0 ); String msg=" "; char thisChar; const int led_rouge = 17; EthernetServer server(3363); void setup() { // initialize the ethernet device pinMode(led_rouge, OUTPUT); Ethernet.begin(mac, ip); // start listening for clients server.begin(); // Open serial communications and wait for port to open: Serial.begin(9600); while (!Serial) { ; // wait for serial port to connect. Needed for Leonardo only digitalWrite(led_rouge, LOW); } Serial.print("Chat server address:"); Serial.println(Ethernet.localIP()); } void loop() { // wait for a new client: EthernetClient client = server.available(); // when the client sends the first byte, say hello: if (client.connected()) { if (client) { if (client.available() != 0) { thisChar = client.read(); msg = String(msg + thisChar); } Serial.print(msg); if (msg == "49") { digitalWrite(led_rouge, HIGH); delay(1000); } else { digitalWrite(led_rouge, LOW); } } } }
Did anyone has an idea how to clean the masseges from LabVIEW?
02-14-2021 07:25 AM
Hey !
I know the thread begins to be old, but do you still have in reserve the Arduino code from the part where you transfer the datas from Arduino to Labview ?
Thanks again for the return !