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

View File

@@ -24,8 +24,7 @@
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include <stdlib.h>
#include "ws2812.h"
#include "ws2812_effect.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@@ -98,6 +97,8 @@ int main(void)
ws2812_Init();
uint32_t mytimer = 0;
/* USER CODE END 2 */
@@ -109,24 +110,27 @@ int main(void)
/* USER CODE BEGIN 3 */
uint8_t r = rand();
uint8_t g = rand();
uint8_t b = rand();
#define EFFECT_TIME 5000
for (uint8_t led = 0; led < 24; led++) {
mytimer = HAL_GetTick();
while(mytimer + EFFECT_TIME > HAL_GetTick()){
ws_Effect_RoudTheClock();
}
uint8_t r = rand();
uint8_t g = rand();
uint8_t b = rand();
ws2812_reset();
ws2812_set_colour(led, r, g, b);
ws2812_update();
HAL_Delay(20);
mytimer = HAL_GetTick();
while(mytimer + EFFECT_TIME > HAL_GetTick()){
ws_Effect_RandRound();
}
HAL_GPIO_TogglePin(LED_Green_GPIO_Port, LED_Green_Pin);
mytimer = HAL_GetTick();
while(mytimer + EFFECT_TIME > HAL_GetTick()){
ws_Effect_RandRand();
}
//HAL_GPIO_TogglePin(LED_Green_GPIO_Port, LED_Green_Pin);
}
/* USER CODE END 3 */