gw.sendVariable - library question



  • Hi,

    getting an example, gw.sendVariable was not recognized and i could not find it.

    Any hint?



  • You should post the code you're trying to compile. But it looks like it is using an older version of MySensors. The object model with Sensor gw is deprecated now.
    To send values to the gateway, you should use MyMessage messageName(CHILD_ID, V_type_of_message);



  • @boum thx, man. i was in doubt, so you confirmed that it's deprecated.

    i was following the code:

    void loop() {     
      // Read digital motion value
      boolean motion = digitalRead( DIGITAL_INPUT_SENSOR ) == LOW; 
    
      // Send debug output to serial monitor
      mprintln(PSTR("Motion sensor %s"), motion ? "ON" : "OFF" );
    
      if (lastMotion != motion) {
        lastMotion = motion;
    
        // Send motion value to sensor
        gw.send( msg.set( motion ? "1" : "0" ) );
      
        if (motion) {
          gw.sleep( SLEEP_TIME );
        }
      }
      
      gw.sleep( INTERRUPT, CHANGE, SLEEP_TIME );
    }
    

    to use the motion sensor without interrupt (pin 2 or 3).


  • Mod

    A guide for converting sketches using MySensors 1.5 to MySensors 2 is available at https://forum.mysensors.org/topic/4276/converting-a-sketch-from-1-5-x-to-2-0-x


Log in to reply
 

Suggested Topics

20
Online

11.4k
Users

11.1k
Topics

112.7k
Posts