Arduino + Serial Dat - Beginners - TouchDesigner Forum Home » Arduino Println N R » Arduino + Serial Dat - Beginners - TouchDesigner Forum Maybe your like Arduino Print R N Arduino Pro Mini 5v 8mhz Arduino Pro Mini 5v Or 3.3v Arduino Pro Mini 5v Tutorial Arduino Pt1000 Circuit Arduino + Serial dat Beginners serial, python stanker2 October 27, 2020, 5:15pm 1 Hello fellow TD gurus, I’ve got some problems sending data from Touchdesigner to the Arduino IDE. My project is about controlling WS2811 LEDs using TD. I’m trying to send <“led_nr” , “color_r” , “color_b” , “color_g”> trough a single line serial message. But somehow only the first value is gotten by the IDE. Here is the .py file from TD, wich is executed at every frames start: nr = op('led_nr').par.value0 red = op('red_value').par.value0 green = op('green_value').par.value0 blue = op('red_value').par.value0 op('serial1').send('<', nr, red, blue, green, '>' , terminator="\n") And here is the Arduino project file: #include <FastLED.h> //Serial comm setup: const byte numChars = 32; char recievedChars[numChars]; char tempChars[numChars]; //Data got from serial int led_nr; int r_val; int g_val; int b_val; boolean newData = false; // How many leds in your strip? #define NUM_LEDS 120 #define DATA_PIN 7 // Define the array of leds CRGB leds[NUM_LEDS]; void setup() { Serial.begin(9600); Serial.println("Please close this serial window in order to use it with TD"); Serial.println(); FastLED.addLeds<WS2811, DATA_PIN, GRB>(leds, NUM_LEDS); } void loop() { recvWithStartEndMarkers(); if (newData == true){ strcpy(tempChars, recievedChars); parseData(); showParsedData(); leds[led_nr] = CRGB(r_val,g_val,b_val); FastLED.show(); newData = false; } } void recvWithStartEndMarkers() { static boolean recvInProgress = false; static byte ndx = 0; char startMarker = '<'; char endMarker = '>'; char rc; while(Serial.available() > 0 and newData == false){ rc = Serial.read(); if(recvInProgress == true){ if(rc != endMarker){ recievedChars[ndx] = rc; ndx++; if(ndx >=numChars){ ndx= numChars-1; } } else { recievedChars[ndx] = '\0'; recvInProgress = false; ndx = 0; newData = true; } } else if(rc == startMarker){ recvInProgress = true; } } } void parseData(){ char * strtokIndx; strtokIndx = strtok(tempChars,","); led_nr = atoi(strtokIndx); strtokIndx = strtok(NULL,","); r_val = atoi(strtokIndx); strtokIndx = strtok(NULL,","); g_val = atoi(strtokIndx); strtokIndx = strtok(NULL,","); b_val = atoi(strtokIndx); } void showParsedData(){ Serial.print("Led nr.: "); Serial.print(led_nr); Serial.print(" "); Serial.print("Color: "); Serial.print(r_val); Serial.print(","); Serial.print(g_val); Serial.print(","); Serial.print(b_val); Serial.println(); Serial.print(""); } Thanks in advance! FaustoB October 28, 2020, 6:30am 2 Hi there, I’m not in front of a computer right now, but perhaps you should consider checking the www.alltd.org website, and search for “arduino”. There are quite few tutorials on sending serial to arduino, as well controlling led pixels. I hope it helps! Tag » Arduino Println N R intln() - Arduino Reference int() - Arduino Reference int For Floating Numbers - Arduino Forum Won't Detect ad Most Of The Time. - Arduino Forum Arduino Nano Or intln() Corrupts Data Lcd Printing This Wierd Simbol - Displays - Arduino Forum Confusing Code Error - Programming Questions - Arduino Forum Problem With RS485 And Serial Print And ModbusMaster - #4 By Blh64 Problem With Python And Arduino In Pyserial - C++ - Stack Overflow Communication Between Raspberry Pi Python And Arduino Arduino LM35DZ X6 Logger - Gists · GitHub Arduino Serial Monitor Tutorial: Basics And Alternatives To Try [PDF] Cursul 4 Programare Arduino - UPIT No Serial Monitor Output For Some Projects - PlatformIO Community