pub struct EasyBlinkController { /* private fields */ }Expand description
The main struct. Use this to declare your controller with the number of LEDs in your strip.
Implementations§
Source§impl EasyBlinkController
impl EasyBlinkController
Sourcepub fn new(num_leds: usize) -> EasyBlinkController
pub fn new(num_leds: usize) -> EasyBlinkController
Creates a new EasyBlinkController.
num_leds should be at least 1.
Example (for a strip with 120 LEDs):
let mut controller = EasyBlinkController::new(120);Sourcepub fn get_num_leds(&self) -> usize
pub fn get_num_leds(&self) -> usize
Simple getter function to get the number of LEDs in an EasyBlinkController.
Sourcepub fn set_num_leds(&mut self, num_leds: usize)
pub fn set_num_leds(&mut self, num_leds: usize)
Simple setter function to set the number of LEDs in an EasyBlinkController.
Sourcepub fn execute_pattern(&mut self, color: Color, pattern: Pattern, delay_ms: u64)
pub fn execute_pattern(&mut self, color: Color, pattern: Pattern, delay_ms: u64)
The main function to execute lighting patterns.
All Color work with all Pattern.
It’s suggested to play around with delay_ms to find a look for the pattern that suits your tastes.
To have the pattern run continuously, you must execute this function within a loop.
Example:
use easyblink::{EasyBlinkController, Color, Pattern};
fn main() {
let mut controller = EasyBlinkController::new(120);
loop {
controller.execute_pattern(Color::Rainbow, Pattern::Chase, 20);
}
}Sourcepub fn execute_colorway_pattern(
&mut self,
pattern: ColorwayPattern,
delay_ms: u64,
)
pub fn execute_colorway_pattern( &mut self, pattern: ColorwayPattern, delay_ms: u64, )
Function to execute patterns with set specific colorways.
Similar to execute_pattern but uses ColorwayPattern.
No Color is passed in since the colors used are specific to the pattern.
It’s suggested to play around with delay_ms to find a look for the pattern that suits your tastes.
Same as execute_pattern, this must be executed within a loop.
Example:
use easyblink::{EasyBlinkController, Color, Pattern};
fn main() {
let mut controller = EasyBlinkController::new(120);
loop {
controller.execute_colorway_pattern(ColorwayPattern::Fireplace, 40);
}
}