From 57ff177211b2c9232d514674f58d76c27baef353 Mon Sep 17 00:00:00 2001 From: Johan Stokking Date: Tue, 18 Apr 2017 16:41:05 +0200 Subject: [PATCH] Removed dependency on LED_BUILTIN --- examples/TheThingsMessage/Receive/Receive.ino | 6 +++--- src/TheThingsMessage.cpp | 4 +++- src/TheThingsMessage.h | 2 -- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/TheThingsMessage/Receive/Receive.ino b/examples/TheThingsMessage/Receive/Receive.ino index f27e79f1..d9c9ec2d 100644 --- a/examples/TheThingsMessage/Receive/Receive.ino +++ b/examples/TheThingsMessage/Receive/Receive.ino @@ -17,7 +17,7 @@ devicedata_t data = api_DeviceData_init_default; void setup() { - pinMode(TTN_PIN_LED, INPUT); + pinMode(LED_BUILTIN, INPUT); loraSerial.begin(57600); debugSerial.begin(9600); @@ -41,7 +41,7 @@ void setup() void loop() { // Read sensors - data.motion = digitalRead(TTN_PIN_LED) == HIGH; + data.motion = digitalRead(LED_BUILTIN) == HIGH; data.water = 682; // Encode data @@ -63,4 +63,4 @@ void message(const uint8_t *payload, size_t length, port_t port) appdata_t appData = api_AppData_init_default; TheThingsMessage::decodeAppData(&appData, payload, length); } -} \ No newline at end of file +} diff --git a/src/TheThingsMessage.cpp b/src/TheThingsMessage.cpp index 6c833f45..e927c377 100644 --- a/src/TheThingsMessage.cpp +++ b/src/TheThingsMessage.cpp @@ -10,7 +10,9 @@ bool TheThingsMessage::decodeAppData(appdata_t *receiveData, const byte *payload { return false; } - receiveData->light ? digitalWrite(TTN_PIN_LED, HIGH) : digitalWrite(TTN_PIN_LED, LOW); +#ifdef LED_BUILTIN + receiveData->light ? digitalWrite(LED_BUILTIN, HIGH) : digitalWrite(LED_BUILTIN, LOW); +#endif return true; } diff --git a/src/TheThingsMessage.h b/src/TheThingsMessage.h index 27eea07a..38a9ccf5 100644 --- a/src/TheThingsMessage.h +++ b/src/TheThingsMessage.h @@ -11,8 +11,6 @@ #include "deviceData.pb.h" #include "appData.pb.h" -#define TTN_PIN_LED LED_BUILTIN - typedef api_DeviceData devicedata_t; typedef api_AppData appdata_t;