Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void blinking(WS2812B *strip, uint32_t delayTime, uint32_t currentTime) //Fill the ring with red color, and wait in each state for the specified time
- {
- if (lastTimeTailLight + delayTime <= currentTime) //If the given amount of time has elapsed
- {
- lastTimeTailLight = currentTime; //Save the current time as the last time of update
- tailLightState += 1; //Increment the state counter by one
- tailLightState %= 2; //As we will have 2 states, we use the modulo operator to get 0 or 1
- if (tailLightState == 0) //If the state is 0
- {
- strip->fill(255, 0, 0); //Turn on the whole strip
- }
- else //If the state is 1
- {
- strip->clear(); //Turn off the whole strip
- }
- strip->update(); //Update the changes
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement