Struct EasyBlinkController

Source
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

Source

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);
Source

pub fn get_num_leds(&self) -> usize

Simple getter function to get the number of LEDs in an EasyBlinkController.

Source

pub fn set_num_leds(&mut self, num_leds: usize)

Simple setter function to set the number of LEDs in an EasyBlinkController.

Source

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);
    }
}
Source

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);
    }
}

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V