several nodes gatewayserial it's possible??(problem).



  • good day
    I have this problem
    I have a couple of nodes connected to the serial gateway (without a controller)
    And the problem is that they cross the transmissions that they send me
    (I need to have the measurements of the nodes separately)
    the question is
    It is possible to avoid the crossings of transmissions so that I get the data of node N first and then the next and so on.

    I hope you can help me with this doubt
    It's for a school project
    Thank you.


  • Hero Member

    @adrian_kbb73

    If i understand correctly you want your nodes to send in the data sequentially and not whenever they like ?

    One way that i can think of would be to use a node to node message from the gateway to trigger the data send on the nodes. The only thing I am not sure of is if this is possible from a gateway but it will be easy enough for you to test and see.


  • Hero Member

    The basic format for a node to node message looks like this

    0_1490134966573_node.jpg

    You would need to place a message send to each of your nodes in your gateways loop part of the sketch. then use a non blocking timer to control when the messages are sent.

    on the nodes you will need to have code to respond to the message, it could be quite basic depending on what sensors etc you have on the node.

    void receive(const MyMessage &message) {
      if (message.type == V_STATUS ) {
    
        // put code here to send data
    
      }
    }
    


  • @Boots33
    Yes, thanks, that's what I want to do.
    I'll prove it.


  • Mod

    If you parse the received message on the gateway, you can have the node ID an thus you will have which sensor sent the data without too much effort, if I understood what you were saying


Log in to reply
 

Suggested Topics

  • 4
  • 2
  • 9
  • 4
  • 2
  • 3

1
Online

11.4k
Users

11.1k
Topics

112.7k
Posts