Cubecell Turn off RGB

Is there a way to turn off and on the RGB led after its compiled as active?

Its nice to have the RGB running when you first install the units but it would be nice to be able to turn it off by sending a command via LoRa, It would also be nice to be able to use the LED to identify the unit if it requires maintenance.

I tried to do an #undef LoraWan_RGB

But that did not seem to work.

38

Arduino IDE : Under tools you can set LORAWAN_RGB …

The issue here is that you would need to go out on site and reprogram every single unit in order to turn the LED off and On. Not ideal with 800+ units.

The hope is to be able to have the LED flash a few times when its installed then once its installed send a command via LoRa to turn the LED off. If in the future some maintenance needs to be done turn it back on for a short time so the tech on site can see it, know its connected then turn it back off once he is done.

Not necessarily … what you will do is basically deactivating the LED at a number of places in the lorawan library - the next step is to insert it into the code at places where you would like to use it look at the sample code included with library, seems pretty straight forward …

#include “CubeCell_NeoPixel.h”
CubeCell_NeoPixel pixels(1, RGB, NEO_GRB + NEO_KHZ800);

void setup() {
// put your setup code here, to run once:
pinMode(Vext,OUTPUT);
digitalWrite(Vext,LOW); //SET POWER
pixels.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
pixels.clear(); // Set all pixel colors to ‘off’
}
uint8_t i=0;

void loop() {
// put your main code here, to run repeatedly:

pixels.setPixelColor(0, pixels.Color(i, 0, 0));

pixels.show();   // Send the updated pixel colors to the hardware.

delay(200); // Pause before next pass through loop

pixels.setPixelColor(0, pixels.Color(0, i, 0));

pixels.show();   // Send the updated pixel colors to the hardware.


delay(200); // Pause before next pass through loop

pixels.setPixelColor(0, pixels.Color(0, 0, i));

pixels.show();   // Send the updated pixel colors to the hardware.

delay(200); // Pause before next pass through loop

i+=10;

}

Yes, I have that and a trigger to use it. What would be nice however if in the library there is a function that will flash the LED depending on the connectivity state. This is enabled by enabling the LORAWAN_RGB value at compile time. Once its on you cant turn it off and once its off unless you recompile.

I guess the option here is to re-write the library on my end and set up a variable instead of using a define to turn it on and off. Its just a really nice indication as to what is foing on and seems to work really well.

Creating a seperate bit of code also works and stickign that in the deviceState switch part that handles the transmissions also works but you dont get the variation in colours dependent on if the cycle is a transmit, receive, join etc…

I was just hoping for an easier solution to redefine a define :slight_smile: save having to change all the #ifdef statements in the library.