int inputPin = 4;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(4, INPUT);
Serial.println("Hello, ESP32-S2!");
}
void loop() {
int val = digitalRead(inputPin);
if (val == HIGH) {
Serial.println("Motion detected!");
}
else {
Serial.println("No Motion detected!");
}
delay(100);
}
Loading
esp32-s2-devkitm-1
esp32-s2-devkitm-1