I am trying to use a potentiometer to move the z rotation of an object in Unity. I am using an Arduino UNO to do this and have figured out how to have the Arduino read out the position of the potentiometer and have converted the data so that it reads from 0 to 360. I am a beginner so I’m pretty much looking up youtube videos and copying and pasting the code into unity, but I can’t find a tutorial for exactly what I need.
This is the code I’ve used for the Arduino, if someone can help me figure out what code to put into Unity so that it reads and uses to data from my Arduino to change to z rotation of an object it would be much appreciated.
void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);
Serial.println(map(sensorValue,0,1023,0,360));
Serial.print(“,”);
delay(1);
}