Skip to content

Instantly share code, notes, and snippets.

@jondkelley
Created July 30, 2025 00:21
Show Gist options
  • Select an option

  • Save jondkelley/435a3658cd866e3b3673ef03f08bab23 to your computer and use it in GitHub Desktop.

Select an option

Save jondkelley/435a3658cd866e3b3673ef03f08bab23 to your computer and use it in GitHub Desktop.
esp32-hearbeat.cpp
#include <Arduino.h>
void setup() {
// Initialize serial communication
Serial.begin(115200);
// Wait for serial to be ready
while (!Serial) {
delay(10);
}
// Clear any garbage data
Serial.flush();
delay(1000);
// Print startup message
Serial.println("\n\n=== ESP32 Basic Test ===");
Serial.println("Hello! ESP32 is working!");
Serial.println("Program compiled: " + String(__DATE__) + " " + String(__TIME__));
Serial.println("Free heap: " + String(ESP.getFreeHeap()) + " bytes");
Serial.println("Chip model: " + String(ESP.getChipModel()));
Serial.println("Flash size: " + String(ESP.getFlashChipSize()) + " bytes");
Serial.println("CPU frequency: " + String(ESP.getCpuFreqMHz()) + " MHz");
Serial.println("=== Test Complete ===\n");
}
void loop() {
// Simple heartbeat every 5 seconds
static unsigned long lastPrint = 0;
if (millis() - lastPrint > 5000) {
lastPrint = millis();
Serial.println("ESP32 heartbeat - uptime: " + String(millis() / 1000) + "s");
}
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment