Closed FokkeZB closed 8 years ago
This fixes #23 in a more clean way than #34 by letting the user set a callback to receive downlink messages.
Note: For now, this doesn't touch the return value, which could now become success/error codes as requested in #11, for which #37 is pending.
In setup() set the callback:
setup()
void setup() { // .. ttn.onMessage(message); // .. }
Elsewhere in your sketch define message or whatever you call it:
message
void message(const byte* buffer, int length, int port) { debugPrint("Receive " + String(length) + " bytes on port " + String(port) + ": "); for (int i = 0; i < length; i++) debugPrint(String(buffer[i]) + " "); debugPrintLn(); }
This fixes #23 in a more clean way than #34 by letting the user set a callback to receive downlink messages.
Note: For now, this doesn't touch the return value, which could now become success/error codes as requested in #11, for which #37 is pending.
In
setup()
set the callback:Elsewhere in your sketch define
message
or whatever you call it: