byte sensorPin = 14;
byte ledPin = 5;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
pinMode(ledPin, OUTPUT);
pinMode(sensorPin,INPUT);
}
void loop(){
// put your main code here, to run repeatedly:
int sensorValue=digitalRead(sensorPin);
Serial.println(sensorValue);
if(sensorValue==HIGH)
{
digitalWrite(ledPin, HIGH);
Serial.println("motion detected...");
}
else{
digitalWrite(ledPin, LOW);
Serial.println("motion not detected..");
}
delay(1000); // this speeds up the simulation
}