Complete the code to read the analog value from the potentiometer.
int sensorValue = analogRead([1]);The potentiometer is connected to analog pin A0, so we use analogRead(A0) to read its value.
Complete the code to print the potentiometer value to the Serial Monitor.
Serial.println([1]);We print the variable sensorValue which stores the potentiometer reading.
Fix the error in the setup function to initialize serial communication.
void setup() {
Serial.begin([1]);
}The standard baud rate for serial communication is 9600 bits per second.
Fill both blanks to create a loop that reads and prints the potentiometer value repeatedly.
void loop() {
int sensorValue = analogRead([1]);
Serial.println([2]);
delay(500);
}The potentiometer is connected to pin A0, and we print the variable sensorValue that stores the reading.
Fill all three blanks to map the potentiometer value to a range from 0 to 255 and print it.
int sensorValue = analogRead([1]); int outputValue = map(sensorValue, [2], 1023, 0, 255); Serial.println([3]);
The potentiometer is read from pin A0. The map function converts the 0-1023 range to 0-255. We print the mapped value outputValue.
