Creepy Noise Program Using The ESP32
fun prank project using the ESP32 — a creepy beeper that beeps at random intervals and enters deep sleep between beeps to save power and avoid suspicion.
๐ฏ Features of Your Creepy Noise Program:
-
Produces a short beep using a buzzer.
-
Beeps at random intervals between 1 and 15 minutes.
-
After beeping, it goes into deep sleep.
-
Wakes up after a random interval and repeats.
๐งพ Wiring Assumptions:
-
Buzzer connected to GPIO 13 (you can change this).
-
Buzzer is active high (set HIGH to beep).
#include <esp_sleep.h>
#define BUZZER_PIN 13 // Change as needed
void setup() {
Serial.begin(115200);
// Initialize buzzer pin
pinMode(BUZZER_PIN, OUTPUT);
digitalWrite(BUZZER_PIN, LOW);
// Beep logic
beep();
// Pick a random time between 1 and 15 minutes (in seconds)
uint32_t minSeconds = 60; // 1 minute
uint32_t maxSeconds = 900; // 15 minutes
uint32_t sleepTime = random(minSeconds, maxSeconds + 1);
Serial.print("Sleeping for ");
Serial.print(sleepTime);
Serial.println(" seconds...");
// Convert seconds to microseconds for esp_sleep
esp_sleep_enable_timer_wakeup(sleepTime * 1000000ULL);
esp_deep_sleep_start();
}
void loop() {
// Not used, ESP will deep sleep after setup
}
void beep() {
Serial.println("Beep!");
digitalWrite(BUZZER_PIN, HIGH);
delay(200); // 200ms beep
digitalWrite(BUZZER_PIN, LOW);
}
Comments
Post a Comment