Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Announcements
  3. 💬 The Sensor Network

💬 The Sensor Network

Scheduled Pinned Locked Moved Announcements
46 Posts 11 Posters 20.4k Views 10 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • RagoTubeR RagoTube

    @jkandasa Hi, thank you, I am a newbie, please advice what are the changes to be done to use Node2Node, to receive data from a sender and display on a LCD or OLED please. I am finding difficult only on the Receiver side, please help.
    With Great Regards,

    J Offline
    J Offline
    jkandasa
    Plugin Developer
    wrote on last edited by jkandasa
    #41

    @RagoTube
    Note: I didn't test this code. I believe it should work.

    Sender node

    #define MY_DEBUG
    #define MY_RADIO_RF24
    #define MY_NODE_ID 21
    
    #define DISPLAY_NODE_ID 0
    
    #define TEMPERATURE_SENSOR_ID 0
    
    #include "MySensors.h"
    
    // triggering interval
    static const uint32_t trigger_ms = 10000; // 10 seconds
    
    uint32_t lastTrigger = 0;
    MyMessage msgGeneral(TEMPERATURE_SENSOR_ID, V_TEMP);
    
    void setup() {
    }
    
    void presentation() {
      sendSketchInfo("Temperature node 1", "1.0");
      present(TEMPERATURE_SENSOR_ID, S_TEMP, "Temperature");
    }
    
    void loop() {
      if (millis() - lastTrigger > trigger_ms) {
        lastTrigger = millis();
        // set destination address
        msgGeneral.setDestination(DISPLAY_NODE_ID);
        
        // get temperature from your temperature sensor
        float lastTemperature = 0.0; // update from your sensor
    
        // send message to display node
        send(msgGeneral.set(lastTemperature));
      }
    }
    

    Display node (Gateway node)

    #define MY_DEBUG
    #define MY_RADIO_RF24
    #define MY_GATEWAY_SERIAL
    
    #define TEMPERATURE_SENSOR_ID 0
    #define TEMPERATURE_NODE_ID 21
    
    #include "MySensors.h"
    
    float lastTemperature = 0.0;
    
    void presentation() {
      sendSketchInfo("Display node / Gateway", "1.0");
    }
    
    void setup() {
    }
    
    void loop() {
    }
    
    void updateDisplay() {
      // update your display with "lastTemperature"
    }
    
    void receive(const MyMessage &message) {
      if (message.sender == TEMPERATURE_NODE_ID) { // message from temperature node
        if (message.sensor == TEMPERATURE_SENSOR_ID && message.type == V_TEMP) { // message from temperature sensor
          lastTemperature = message.getFloat();
          updateDisplay(); // update display
        }
      }
    }
    
    1 Reply Last reply
    0
    • RagoTubeR Offline
      RagoTubeR Offline
      RagoTube
      wrote on last edited by
      #42

      Thank you so much and very kind of you. I will try this.

      1 Reply Last reply
      0
      • RagoTubeR Offline
        RagoTubeR Offline
        RagoTube
        wrote on last edited by
        #43

        Hai jkandasa, It works fine, thank you so much for your examples and it cleared lot my doubts. Thanks again, you have given me good start.

        1 Reply Last reply
        1
        • RagoTubeR Offline
          RagoTubeR Offline
          RagoTube
          wrote on last edited by
          #44

          Hi, I missed to notice that, it works as long as the Gateway is ON, when I turn off the Gateway it stops receiving the data. I assumed that your example "Node2Node" code will work with out a Gateway in between. Please advice.

          J 1 Reply Last reply
          0
          • RagoTubeR RagoTube

            Hi, I missed to notice that, it works as long as the Gateway is ON, when I turn off the Gateway it stops receiving the data. I assumed that your example "Node2Node" code will work with out a Gateway in between. Please advice.

            J Offline
            J Offline
            jkandasa
            Plugin Developer
            wrote on last edited by jkandasa
            #45

            @RagoTube looks like we need a gateway in a sensor network and with the help of gateway node-node communication can happen. The beauty of MySensors gateway is, you can use your gateway as a node.
            I just updated my example shown here. Now the display node is a gateway node.

            1 Reply Last reply
            0
            • RagoTubeR Offline
              RagoTubeR Offline
              RagoTube
              wrote on last edited by
              #46

              Thanks again for your immediate advice. It should be OK now.

              1 Reply Last reply
              1

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              21

              Online

              12.1k

              Users

              11.2k

              Topics

              113.4k

              Posts


              Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • MySensors
              • OpenHardware.io
              • Categories
              • Recent
              • Tags
              • Popular