Led driver libraries for Azure Sphere
- Driving Rgb-Leds and and simple rgb-led strips with PWM
- Driving Apa102 and similar leds using SPI
- Connect the color channels to 3 pwm-enabled gpio pins
- Connect the leds ground to a ground pin
- Connect 3 pwm enabled gpio-pins to your booster circuit
- Connect the boosters output to your led-strip
- Connect the boosters positive input to a power-supply
- Connect the the boosters ground to the power supply and to the Sphere's ground
- Connect the SPI-CLK pin to the led's CI connection
- Connect the SPI-MOSI pin to the led's DI connection
- Connect the led's 5v to a power supply
- Connect the led's GND to the power supply and to Sphere's GND pin
Use the provided samples or start from scratch
- Find the controller_id and the ids of the pins you connected to
- Add "Pwm":
[ "PWM-CONTROLLER-{yourControllerId}" ]
to the applications manifest capabilities - Add the setup and teardow methods:
SetupPwm(unsigned int controller_id, uint32_t redPin, uint32_t greenPin, uint32_t bluePin);
Teardown();
- Set the desired color by using the color-srtruct or by setting the values directly
SetColor(struct Color color);
SetColorFromInt(int red, int green, int blue);
SetColorFromBytes(uint8_t red, uint8_t green, uint8_t blue);
- Find the interface_id and the chipselct_id of the interface you used
- Add
"SpiMaster": [ "ISU{interface_id}" ]
to the applications manifest capabilities - Add the setup and teardow methods:
SetupApa102(int interfaceId, int chipSelectId);
Teardown();
4.1. Set the whole strip to a solid color: SetSolid(struct ColorWithBrightness color, int length);
4.2. Set the whole strip to custom colors: SetCustom(struct ColorWithBrightness *color, int length);
4.3. Stream colors to the leds, from the first to the last:
PrepareForStreaming();
while(?)
{
AppendColor(struct ColorWithBrightness color);
}
FinishStreaming();