Arduino library for controlling standard LEDs using pwm for duty cycling.
LEDDriver provides an easy approach to controlling LEDs using built in PWM functionality. LEDDriver is used much like other libraries for Arduino.
// Create the LED instance and the Hardware Abstration Layer driver
LEDDriver LED;
PWMDriver *hal = new PWMDriver();
// Attach led on pin LED_BUILTIN to channel
hal->attach(LED_BUILTIN, 0);
// Start and initialize the LED libray
LED.begin(hal);
// Set the led attached to channel 0 to full duty cycle (on)
LED.set(0, 255);
// Set the led attached to channel 0 to half duty cycle (faded)
LED.set(0, 128);
led-basic.ino
- Demonstrates basic useled-blink.ino
- Demonstrates using blink (executed in the background)led-blink-advanced.ino
- Demonstrates using blink (executed in the background)led-fade.ino
- Demonstrates how to fade the led to a specific levelled-fade-manual.ino
- Demonstrates how to manualy control the fade level of a led
...and many more. Check out the examples folder.
This library has also been pulished on PlatformIO and is available through PlatformIO's library management.