Effects added :-)

This commit is contained in:
StefansE
2026-03-25 19:06:44 +01:00
parent 7aea97a648
commit 5a4d46bbba
6 changed files with 104 additions and 21 deletions

60
Core/Src/ws2812_effect.c Normal file
View File

@@ -0,0 +1,60 @@
/*
* 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);
}