Transmit LED always lit on gateway?
-
I'm wiring up 3 LED's to mount on my gateway case (TX, RX, ERROR) using the standard pins for an MQTT gateway (Pins 9, 8, 7 respectively). When I power on the gateway, it starts fine but the transmit LED is always lit (and the other two stay off). One of the comments in the sketch says pin 9 is the on board LED pin. Is that what's causing the problem? I'm assuming the transmit LED shouldn't be on all the time right?
-
Which version of the MySensors library?
-
Sorry - v1.5 of mysensors. Running on an Uno w/ Ethernet shield.
-
Hmm.. there has been some work done to incorporate the LED blinking into the MySensors library (enable it in MyConfig.h)..
But as no-one maintains the MQTT gateway any longer (@Damme where are you? ) I guess the blink functionality is a bit messed up right now as the sketch itself seems to fiddle with the leds itself. You can most probably just remove the led-stuff from the sketch ino file and enable the feature WITH_LEDS_BLINKING in MyConfig.
Read more about how to set the LED pins in the constructor here:
http://www.mysensors.org/download/sensor_api_15#the-full-api
-
OK - I'll work on it and send a pull request when I'm done. The ethernet and serial code seems pretty clear wrt the LED's so I'll just use that as a template.
-
FYI - I removed all the LED pin handling from the MQTT gateway and changed the blink calls to go through the gateway. Reloading and I get the TX and RX lights continuously lit. So I thought I must be missing something so I build the plain ethernet gateway w/ LED support and I get the same thing - TX and RX lights are lit with nothing happening.
So either my wiring is screwed up or something is wrong w/ the 1.5 LED code. I'm going to start looking into that and if I find anything I'll open a github issue and get a fix submitted.
-
@hek I think this might be a documentation problem in the web site. The code sets the LED pins to OUTPUT and LOW for off, HIGH for on. The web site (http://www.mysensors.org/build/advanced_gateway) says:
"Each LED is connected by its anode (long leg) to +5V. The cathode (short leg) is connected through a resistor to one of the following digital pins of the Arduino"
At least the way I read the code, it should say something like:
"Each LED is connected by its anode (long leg) to the digital pin. The cathode (short leg) is connected through a resistor to ground."
Does that sound right?
-
The documentations for this has not been updated in long time (should at least mention WITH_LEDS_BLINKING now!). I will update.
I'm confused now, do you mean that the behaviour changed with this pull request?
https://github.com/mysensors/Arduino/pull/109/filesOr has this been wrong for a longer period? It would be quite easy to have a MY_INVERSE_LEDS-define option in MyConfig to help people decide how to wire this themselves.
-
I'm not sure when it changed (or if it was wrong the whole time) - just that it didn't work for me with the mqtt gateway or the ethernet gateway. I will set up a pull request to update the MqttGateway to use WITH_LEDS_BLINKING. I don't think there is any reason to have it different than the other gateways. The code is trivial - I'm just waiting on some sensor nodes so I can properly test it.
-
Great, thanks...
-
Hello There,
I have the same problem in the serial gateway and the version 1.5, that all 3 LEDs burn.In version 1.4 the SerialGateway everything is ok.
-
@hek FYI - here's the commit that reversed the LED pins 23 days ago. The note doesn't say why it was done. https://github.com/mysensors/Arduino/commit/4abaa6ded34d22e3f3dd98d33d3d12450a537706#diff-957e773aa509ae0ea23a62fad74212a4
-
We better ping @blacey on this who might enlighten us when back from vacation.
-
I've been using a version of the mqtt gateway for about 6 months, i setup the LED's like it shows in the advanced build, and they all (3) run with on all the time, and off when activated, i assumed at the time that this was by design, and it's quite nice to have a clear visual indication that things are all ok, with the occasional blink when there is a message received. i quite like it now. my file was compiled with version 1.4.1 modified library. but i believe it was the same behavior with 1.4 also.
Just incase it helps.
-
Ok, good to know. We could perhaps have the "MY_INVERSE_LEDS" option to make it easy to switch between the two behaviours.
-
Ok, patched the inversed behaviour and fixed the new config option.
https://github.com/mysensors/Arduino/commit/cb83bfbdb3ed32ef57040cff9954b390ec9a2528