adafruit / Adafruit_IO_Arduino

Arduino library to access Adafruit IO from WiFi, cellular, and ethernet modules.
Other
208 stars 108 forks source link

Expose WiFi.setLEDs(r, g, b) through AdafruitIO_AIRLIFT class. #133

Closed ptbw closed 4 years ago

ptbw commented 4 years ago

The purpose of this change to to allow access to the setLEDs method in the WiFi class used by the Adafruit AirLift module. Making it very simple to add a status light to the class, and allow the visual inspection of the connection.

The change adds a single public method to the AdafruitIO_AIRLIFT class which is only available if included using #define USE_AIRLIFT or similar, so will only be available to specifically including ..IO_AIRLIFT.h

I made a small modification to the AdafruitIO_LEDTest example (supplying a colour from Adafruit.IO):

void handleMessage(AdafruitIO_Data *data) {
  // print RGB values and hex value
  Serial.println("Received HEX: ");
  Serial.println(data->value());

  int red = data->toRed();
  int grn = data->toGreen();
  int blu = data->toBlue();
  Serial.println(red);
  Serial.println(grn);
  Serial.println(blu);
  io.setLEDs( red, grn, blu);
}

The example builds when using #define USE_AIRLIFT in the supplied config.h.

brentru commented 4 years ago

@ptbw Thanks for making comments more explicit, I'll test on hardware and merge once it's passing the CI.

This PR is failing our CI build at the Clang step (https://github.com/adafruit/Adafruit_IO_Arduino/pull/133/checks?check_run_id=981225404#step:8:1).

brentru commented 4 years ago

I made a small modification to the AdafruitIO_LEDTest example (supplying a colour from Adafruit.IO):

@ptbw Do you want to add an example for this into examples? If not everything looks good and I can merge/release

ptbw commented 4 years ago

Go a head and merge, I can't really test any example on anything other than the Airlift feather wing. But I have learnt a lot from this so thank you for your patience.