Added button to give fast command access
This commit is contained in:
@@ -8,6 +8,9 @@
|
|||||||
#define SENDER_ID 0xAA
|
#define SENDER_ID 0xAA
|
||||||
#define SELF_ID 0xAB
|
#define SELF_ID 0xAB
|
||||||
|
|
||||||
|
#define BUTTON_PULLUP_PIN 22
|
||||||
|
#define BUTTON_SIGNAL_PIN 19
|
||||||
|
|
||||||
#define LORA_SCK 5
|
#define LORA_SCK 5
|
||||||
#define LORA_MISO 19
|
#define LORA_MISO 19
|
||||||
#define LORA_MOSI 27
|
#define LORA_MOSI 27
|
||||||
@@ -96,6 +99,9 @@ void handleCommandG() {
|
|||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
|
||||||
|
pinMode(BUTTON_PULLUP_PIN, INPUT_PULLUP);
|
||||||
|
pinMode(BUTTON_SIGNAL_PIN, INPUT_PULLDOWN);
|
||||||
|
|
||||||
// OLED init
|
// OLED init
|
||||||
Wire.begin(); // SDA/SCL Default
|
Wire.begin(); // SDA/SCL Default
|
||||||
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
|
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
|
||||||
@@ -117,6 +123,16 @@ void setup() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
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()) {
|
if (Serial.available()) {
|
||||||
char cmd = Serial.read();
|
char cmd = Serial.read();
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
|
|||||||
Reference in New Issue
Block a user