Basic Setup Network
-
Sorry I know that I am writing a stupid question but I am a little bit confused. I am trying to make a very basic node to node program; from one NRF24 to another NRF24. Send command from 1 module to light LED on the other module. I read more than twice the API (http://www.mysensors.org/download/sensor_api_15) but still get ground! Is there a basic network please to light led on the other side and I will continue from there please?
Sorry once again, but I really need some help to get on.
-
this is my node to node program:
// Enable debug prints #define MY_DEBUG #define SWITCH_PIN 2 // Enable and select radio type attached #define MY_RADIO_NRF24 //#define MY_RADIO_RFM69 boolean state=false; #include <SPI.h> #include <MySensor.h> #define MY_NODE_ID 10 #define CHILD_ID_SWITCH 1 MyMessage switchMsg(CHILD_ID_SWITCH, V_LIGHT); void setup() { pinMode(SWITCH_PIN,INPUT_PULLUP); } void loop() { if(digitalRead(SWITCH_PIN)==LOW) { delay(100); if(digitalRead(SWITCH_PIN)==HIGH); { state=!state; if(state) { send(switchMsg.setDestination(2).set(49)); } else { send(switchMsg.setDestination(2).set(0)); } } } }
- destination node id is 2
- destination of type light variable
1 out of 2
Suggested Topics
-
Update RF24 library to latest version
Bug Reports • 23 Mar 2014, 23:37 • andriej 24 Mar 2014, 22:52 -
No merge into master in the last 5 years, should we use development?
General Discussion • 23 Sept 2024, 17:48 • kiesel 23 days ago -
is this project dead?
General Discussion • 7 days ago • perfectom 7 days ago -
ESP-NOW
General Discussion • 22 Apr 2018, 05:58 • NeverDie 17 Feb 2025, 22:24 -
Code Garage to the rescue.
General Discussion • 11 Jan 2025, 11:25 • skywatch 7 days ago -
Which device I have to use to connect with accelerometer before connecting to my pc?
General Discussion • 24 Jan 2023, 17:16 • Yada Kijsathan 16 Mar 2025, 20:17