Last active
October 3, 2017 13:48
-
-
Save SijmenHuizenga/009b6437fd9cb0ae35189adbf949dc72 to your computer and use it in GitHub Desktop.
MySensors Ping Pong (gateway <--> sensor)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MY_DEBUG | |
#define MY_RADIO_NRF24 | |
#define MY_RF24_CHANNEL 69 | |
#define MY_NODE_ID 0 | |
#define MY_GATEWAY_SERIAL | |
#include <MySensors.h> | |
#define PONGNODEID 15 | |
MyMessage msg(MY_NODE_ID, V_VAR1); | |
void setup(){ | |
msg.setDestination(PONGNODEID); | |
} | |
void presentation(){} | |
long lastSent = 0; | |
void loop(){ | |
if(millis() - lastSent >= 3000){ | |
lastSent = millis(); | |
send(msg.set("Message Gateway -> Pongnode")); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MY_DEBUG | |
#define MY_RADIO_NRF24 | |
#define MY_RF24_CHANNEL 69 | |
#define MY_NODE_ID 15 | |
#include <SPI.h> | |
#include <MySensors.h> | |
#define GATEWAYID 0 | |
MyMessage msg(MY_NODE_ID, V_VAR1); | |
void setup() { | |
msg.setDestination(GATEWAYID); | |
} | |
void presentation() { | |
sendSketchInfo("Pong Node", "1.0"); | |
} | |
void loop(){} | |
void receive(const MyMessage &message){ | |
send(msg.set("Mesage Pongnode -> Gateway")); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MY_DEBUG | |
#define MY_RADIO_NRF24 | |
#define MY_RF24_CHANNEL 69 | |
#define MY_NODE_ID 10 | |
#define MY_REPEATER_FEATURE | |
#include <SPI.h> | |
#include <MySensors.h> | |
void setup() { } | |
void presentation() { | |
sendSketchInfo("Repeater Node", "1.0"); | |
} | |
void loop(){} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment