Navigation

    • Register
    • Login
    • OpenHardware.io
    • Categories
    • Recent
    • Tags
    • Popular
    1. Home
    2. SteveO1234
    3. Best
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Best posts made by SteveO1234

    • RE: Noob--API help?

      Thanks for the encouragement and help! So it seems as I need to create this message handler function that is referenced in the gw.begin().. And from that point any incoming messages are routed through the function?

      //
      void incomingMessage(const MyMessage &message)
      {
        if (message.isAck())
        {
          Serial.println("This is an ack from gateway");
        }
        if (message.type == V_LIGHT)
        {
          // Change relay state
          state = message.getBool();
          Serial.print ("State = ");
          Serial.print (state);
          // Store state in eeprom
          gw.saveState(ID, state);
          Serial.print("Incoming change for sensor:");
          Serial.print(message.sensor);
          Serial.print(", New status: ");
          Serial.println(message.getBool());
        }
      }
      //
      
      posted in Development
      SteveO1234
      SteveO1234