WITH_LEDS_BLINKING - for gateways only?



  • Hi all,

    For some of my sensors that are fully powered (as opposed to battery powered ones), I'd like to get quick and dirty visual confirmation that they are sending and receiving data. I'm trying to use the WITH_LEDS_BLINKING functionality. But the behavior I'm seeing that transmit never comes on, and receive seems to come on at unrelated and random times. It occurs to me that functionality may be intended for gateways only and tied to some gateway specific functionality. Is that the case? I figured I'd ask before I go digging around in the code to see why they aren't working for me...

    thanks,
    --Steve


  • Admin

    Hmm..strange, it should work. A Gateway or Sensor should work the same way when it comes to radio transmits/reads.. Feel free to dig.



  • Ok, will do... my experience is that TX never blinked at all, and RX seemed to come on for about 20-30 seconds out of every minute. but I'll try to troubleshoot some more when I have time.



  • Hi all!

    In my case the LEDs do not blink on sensor nodes when I use a gw.sleep(xxx) function in the sketch. Still don't know why its happening.
    (MySensors v1.5)



  • MySensors 1.5.1
    Controller: Domoticz

    I'm using a simpel test sensor with the "blinking led's" to find "dead zones" in my house. The "blinking led's" are a big help for this and works flawlessly all the time.

    /**
     * The MySensors Arduino library handles the wireless radio link and protocol
     * between your home built sensors/actuators and HA controller of choice.
     * The sensors forms a self healing radio network with optional repeaters. Each
     * repeater and gateway builds a routing tables in EEPROM which keeps track of the
     * network topology allowing messages to be routed to nodes.
     *
     * Created by Henrik Ekblad <henrik.ekblad@mysensors.org>
     * Copyright (C) 2013-2015 Sensnology AB
     * Full contributor list: https://github.com/mysensors/Arduino/graphs/contributors
     *
     * Documentation: http://www.mysensors.org
     * Support Forum: http://forum.mysensors.org
     *
     * This program is free software; you can redistribute it and/or
     * modify it under the terms of the GNU General Public License
     * version 2 as published by the Free Software Foundation.
     *
     *******************************
     */
    #include <SPI.h>
    #include <MySensor.h>
    
    #define CHILD_ID_BUTTON 0        //pushbutton attached to interrupt 0 (= pin 2).
    #define CHILD_ID_LED 1           //LED that is switch on/off by the controller (Domoticz).
    
    MySensor gw;
    
    MyMessage msg(CHILD_ID_LED, V_LIGHT);
    MyMessage msg2(CHILD_ID_BUTTON, V_STATUS);
    
    byte firstTime = 1;     //make sure that the mcu is going to sleep for the first time (no loop)
    
    void setup() {
      
    gw.begin(incomingMessage);
    gw.sendSketchInfo("Test sensor","1.0");
    gw.present(CHILD_ID_LED, S_LIGHT); 
    gw.present(CHILD_ID_BUTTON, S_BINARY);  
    
    pinMode(2, INPUT_PULLUP);        //interrupt = 0;
    
    pinMode(7, OUTPUT);              //LED is attached to pin 7
    digitalWrite(7, LOW);            //make sure that the LED is off
    
    }
    
    void loop() { 
      if(firstTime == 0) {
        gw.process();
        
        gw.send(msg2.set(1)); // send to controller a message that the button has been pushed. The controller then swithes the LED on (incomingMessage)
        gw.wait(2000);
        if(digitalRead(7) == HIGH) digitalWrite(7, LOW); // switch the LED off after 2 seconds 
        gw.send(msg.set(0)); // let the controller know that the mcu has switched off the LED
        gw.wait(2000);   
      } 
      
      firstTime = 0;
      gw.sleep(0,FALLING); // go to sleep and wait for the next button push 
    }
    
    void incomingMessage(const MyMessage &message) {
      if (message.type == V_LIGHT) {
        if (message.getInt() == 1) digitalWrite(7, HIGH);  
      }
    }
    

Log in to reply
 

Suggested Topics

  • 1
  • 2
  • 3
  • 3
  • 5
  • 10

0
Online

11.4k
Users

11.1k
Topics

112.7k
Posts