// Define pin numbers for relay control and potentiometer
const int relayPin = 2; // Change this to the GPIO pin you're using for relay control
const int potPin = 34; // Change this to the GPIO pin you're using for the potentiometer
void setup() {
// Set the relay pin as an output
pinMode(relayPin, OUTPUT);
}
void loop() {
// Read the value from the potentiometer
int potValue = analogRead(potPin);
// Check if the potentiometer is halfway turned (approximately)
if (potValue > 1000 - 50 && potValue < 1000 + 50) {
// Turn on the relay
digitalWrite(relayPin, HIGH);// Wait for 500 milliseconds
}
else{
digitalWrite(relayPin, LOW); // Wait for 500 milliseconds
}
}
esp:0
esp:2
esp:4
esp:5
esp:12
esp:13
esp:14
esp:15
esp:16
esp:17
esp:18
esp:19
esp:21
esp:22
esp:23
esp:25
esp:26
esp:27
esp:32
esp:33
esp:34
esp:35
esp:3V3
esp:EN
esp:VP
esp:VN
esp:GND.1
esp:D2
esp:D3
esp:CMD
esp:5V
esp:GND.2
esp:TX
esp:RX
esp:GND.3
esp:D1
esp:D0
esp:CLK
relay1:VCC
relay1:GND
relay1:IN
relay1:NC
relay1:COM
relay1:NO
pot1:GND
pot1:SIG
pot1:VCC