I've got this piece of code that is changing the colour of 10 LEDs:
Code: Select all
void Circle_Rainbow() {
sendData(Turn_LED3_Red, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED4_Amber, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED5_Blue, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED6_White, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED7_Green, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED8_Red, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED9_Amber, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED0_Blue, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED1_White, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED2_Green, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED3_Red, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED4_Amber, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED5_Blue, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED6_White, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED7_Green, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED8_Red, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED9_Amber, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED0_Blue, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED1_White, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
sendData(Turn_LED2_Green, 8);
vTaskDelay(75 / portTICK_PERIOD_MS);
}
I'll use a button to cancel it, but I can't figure out how.
Right now, if I start it, I need to wait until is finished.
Maybe I need to modify the code so I won't change the LED's colour from inside a void?
Anybody can give me a hint?
Thanks,
Regards.