Files
RingClock/Core/Src/ws2812_effect.c
2026-03-25 19:06:44 +01:00

61 lines
853 B
C

/*
* ws2812_effect.c
*
* Created on: Mar 25, 2026
* Author: ewars
*/
#include "ws2812_effect.h"
#include "ws2812_drv.h"
#include <stdlib.h>
void ws_Effect_RoudTheClock(void){
uint8_t r = rand();
uint8_t g = rand();
uint8_t b = rand();
for (uint8_t led = 0; led < 24; led++) {
ws2812_reset();
ws2812_set_colour(led, r, g, b);
ws2812_update();
HAL_Delay(20);
}
}
void ws_Effect_RandRound(void){
uint8_t r = rand();
uint8_t g = rand();
uint8_t b = rand();
for (uint8_t led = 0; led < 24; led++) {
ws2812_set_colour(led, r, g, b);
ws2812_update();
HAL_Delay(20);
}
}
void ws_Effect_RandRand(void){
#define RAND_MAX 255
uint8_t r = rand();
uint8_t g = rand();
uint8_t b = rand();
#define RAND_MAX 24
uint8_t led = rand();
ws2812_set_colour(led, r, g, b);
ws2812_update();
HAL_Delay(1);
}