first commit

This commit is contained in:
Carsten Graf
2025-06-01 11:51:02 +02:00
commit 2d2ee0a41a
22 changed files with 3241 additions and 0 deletions

54
src/statusled.h Normal file
View File

@@ -0,0 +1,54 @@
#include <Arduino.h>
#define LED_PIN LED_BUILTIN
// Status LED
unsigned long lastLedBlink = 0;
bool ledState = false;
void updateStatusLED(int blinkPattern) {
unsigned long currentTime = millis();
switch (blinkPattern) {
case 0: // Suche Master - Langsames Blinken
if (currentTime - lastLedBlink > 1000) {
ledState = !ledState;
digitalWrite(LED_PIN, ledState);
lastLedBlink = currentTime;
}
break;
case 1: // Verbunden - Kurzes Blinken alle 3 Sekunden
if (currentTime - lastLedBlink > 3000) {
digitalWrite(LED_PIN, HIGH);
delay(100);
digitalWrite(LED_PIN, LOW);
lastLedBlink = currentTime;
}
break;
case 2: // Button gedrückt - Schnelles Blinken 3x
static int blinkCount = 0;
if (currentTime - lastLedBlink > 100) {
ledState = !ledState;
digitalWrite(LED_PIN, ledState);
lastLedBlink = currentTime;
blinkCount++;
if (blinkCount >= 6) { // 3 komplette Blinks
blinkCount = 0;
blinkPattern = 1; // Zurück zu verbunden
}
}
case 3: // Flash bei Empfang - Einmaliges kurzes Blinken
{
digitalWrite(LED_PIN, HIGH);
delay(100);
digitalWrite(LED_PIN, LOW);
}
break;
}
}