I want to have 6 potentiometers reading out to serial in a sequence similar to this.
pot1
pot2
pot3
pot4
pot5
pot1
...continuing
I figured out how to get 1 pot to read out but im having problems getting them all to read out in that order. Below is what im using for the code. If you have any suggestions as to what im doing wrong please share.
const int pot1 = A0;
const int pot2 = A1;
const int pot3 = A2;
const int pot4 = A3;
const int pot5 = A4;
int sensorValue = 0;
int outputValue = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
//to print results of pot1
sensorValue = analogRead(pot1);
outputValue = map(sensorValue, 0, 1023, 0, 255);
Serial.print("pot1" );
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
//to print results of pot2
sensorValue = analogRead(pot2);
outputValue = map(sensorValue, 0, 1023, 0, 255);
Serial.print("pot2" );
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
//to print results of pot3
sensorValue = analogRead(pot3);
outputValue = map(sensorValue, 0, 1023, 0, 255);
Serial.print("pot3" );
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
//to print results of pot4
sensorValue = analogRead(pot4);
outputValue = map(sensorValue, 0, 1023, 0, 255);
Serial.print("pot4" );
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
//to print results of pot5
sensorValue = analogRead(pot5);
outputValue = map(sensorValue, 0, 1023, 0, 255);
Serial.print("pot5" );
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
}