From a57d363220c44376a14b6dbaeb62f1b9b927e172 Mon Sep 17 00:00:00 2001 From: Ano-sys Date: Fri, 18 Jul 2025 22:50:49 +0200 Subject: [PATCH] Added button to give fast command access --- LoRaReceiver/LoRaReceiver.ino | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/LoRaReceiver/LoRaReceiver.ino b/LoRaReceiver/LoRaReceiver.ino index 3b155c3..fbe6725 100644 --- a/LoRaReceiver/LoRaReceiver.ino +++ b/LoRaReceiver/LoRaReceiver.ino @@ -8,6 +8,9 @@ #define SENDER_ID 0xAA #define SELF_ID 0xAB +#define BUTTON_PULLUP_PIN 22 +#define BUTTON_SIGNAL_PIN 19 + #define LORA_SCK 5 #define LORA_MISO 19 #define LORA_MOSI 27 @@ -96,6 +99,9 @@ void handleCommandG() { void setup() { Serial.begin(115200); + pinMode(BUTTON_PULLUP_PIN, INPUT_PULLUP); + pinMode(BUTTON_SIGNAL_PIN, INPUT_PULLDOWN); + // OLED init Wire.begin(); // SDA/SCL Default if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { @@ -117,6 +123,16 @@ void setup() { } void loop() { + if (digitalRead(BUTTON_SIGNAL_PIN) == HIGH) { + Serial.println("Button gedrueckt -> sende 'g'"); + showOnOLED("Knopf gedrueckt", "GPS angefragt"); + + handleCommandG(); + + while (digitalRead(BUTTON_SIGNAL_PIN) == HIGH) delay(10); + delay(50); + } + if (Serial.available()) { char cmd = Serial.read(); switch (cmd) {