I've been trying to read an output from the potentiometer and map the values from the base values of 0 - 1023 to values of 1 - 24 (I need it for a 24 hour time thing). I've got the code displaying to the serial monitor, but it's only display the base values, not the mapped ones. Is anyone able to help?
void setup() {
//the setup routine runs once when you press reset
Serial.begin(9600); //initialize serial communication at 9600 bits per second
}
void loop() {
//the loop routine runs over and over again forever
int sensorValue = analogRead(A0); //read the input on analog pin 0
map(sensorValue, 0, 1023, 1, 24);
Serial.println(sensorValue); //print out the value you read
delay(10); //delay in between reads for stability
}
Potentiometer_Value_Test.ino (505 Bytes)