void setup() {
Serial.begin(115200);
Serial.println("Practical Test 1: Short Questions (Friday)");
Serial.println(" 1. Press the button to turn OFF the blue LED");
Serial.println(" 2. Periodically print the raw value of the potential meter");
Serial.println(" 3. If the raw count >2000, turn ON the red LED");
pinMode(32,INPUT_PULLUP);
pinMode(14, INPUT);
pinMode(23, OUTPUT);
pinMode(19, OUTPUT);
}
void loop() {
int buttonState = digitalRead(32);
if (buttonState == LOW) {
digitalWrite(23, LOW);
} else {
digitalWrite(23, HIGH);
}
// Read potentiometer value
int potValue = analogRead(14);
Serial.print("Potentiometer value: ");
Serial.println(potValue);
if (potValue > 2000) {
digitalWrite(19, HIGH);
} else {
digitalWrite(19, LOW);
}
delay(500);
}Practical Test 1: Short Question (Friday)
1. Press the button to turn OFF the blue LED
2. Periodically print the raw count of the potential meter
3. If the raw count>2000, turn ON the red LED