PotPosition_value = analogRead(PotPin); //Read and save analog value from potentiometer
PotPosition_value = map(analogRead(PotPosition_value), 0, 1023, 1500, 8500);
Serial.println(PotPosition_value);
I managed to get the max value. however, the value is unstable:
This code is not correct - the second line is doing an analogRead() on an invalid I/O pin
PotPosition_value = analogRead(PotPin); //Read and save analog value from potentiometer
PotPosition_value = map(analogRead(PotPosition_value), 0, 1023, 1500, 8500); //This is for Launch use only
Serial.println(PotPosition_value);
I think it should be
PotPosition_value = analogRead(PotPin); //Read and save analog value from potentiometer
PotPosition_value = map(PotPosition_value, 0, 1023, 1500, 8500); //This is for Launch use only
Serial.println(PotPosition_value);
And it would be easier to debug if you separate the mapped value from the original value - like this
PotPosition_value = analogRead(PotPin); //Read and save analog value from potentiometer
MappedPosition_value = map(PotPosition_value, 0, 1023, 1500, 8500); //This is for Launch use only
Serial.println(PotPosition_value);
Serial.println(MappedPosition_value);
Robin2:
This code is not correct - the second line is doing an analogRead() on an invalid I/O pin
PotPosition_value = analogRead(PotPin); //Read and save analog value from potentiometer
PotPosition_value = map(analogRead(PotPosition_value), 0, 1023, 1500, 8500); //This is for Launch use only
Serial.println(PotPosition_value);
I think it should be
PotPosition_value = analogRead(PotPin); //Read and save analog value from potentiometer
PotPosition_value = map(PotPosition_value, 0, 1023, 1500, 8500); //This is for Launch use only
Serial.println(PotPosition_value);
And it would be easier to debug if you separate the mapped value from the original value - like this
PotPosition_value = analogRead(PotPin); //Read and save analog value from potentiometer
MappedPosition_value = map(PotPosition_value, 0, 1023, 1500, 8500); //This is for Launch use only