int arraySize = 2; float start; float sensorTurn = 0;// variable to store the value coming from the sensor float unity[] = {sensorTurn, start}; void setup() { Serial.begin(9600); //set baudrate, same as Unity } void loop() { sensorTurn = analogRead(A0); // retrieve data from potentiometer start = analogRead(A1); // retrieve data from on/off button // convert data to fit between -1 and 1 sensorTurn = sensorTurn / 511.5; sensorTurn = sensorTurn - 1; // round to 0.05 sensorTurn = sensorTurn * 200; sensorTurn = round(sensorTurn); sensorTurn = sensorTurn / 200; unity[0] = sensorTurn; // set first value in array as sensorTurn unity[1] = start; // set second value in array as start // print every value in the array seperately for(int i = 0; i < arraySize; i++){ Serial.print(unity[i]); // print data for Unity Serial.print("_"); // seperate value for Unity split with "_" } Serial.println("0"); // asssures that seperate loops are on new lines for Unity "ReadLine" delay(100); //set reasonable delay for Unity Serial.flush(); //clears any possible leftover information }