Page 175 - MDP2022-2
P. 175

void  set_ledPattern1(void)  {
                  static  uint8_t  r  =  200,  g  =  00,  b  =  0;
                  static  uint8_t  step  =  0;
                  static  uint8_t  num  =  4,  end  =  200;
                  static  int  i  =  0;


                  Set_LED(i,  r,  g,  b);
                  if  (step  ==  0)  {
                        if  (g  <  end)
                              g  +=  num;
                        else
                              step  =  1;
                  }  else  if  (step  ==  1)  {
                        if  (r  >  0)
                              r  -=  num;
                        else
                              step  =  2;
                  }  else  if  (step  ==  2)  {
                        if  (b  <  end)
                              b  +=  num;
                        else
                              step  =  3;
                  }  else  if  (step  ==  3)  {
                        if  (g  >  0)
                              g  -=  num;
                        else
                              step  =  4;
                  }  else  if  (step  ==  4)  {
                        if  (r  <  end)
                              r  +=  num;
                        else
                              step  =  5;
                  }  else  if  (step  ==  5)  {
                        if  (b  >  0)
                              b  -=  num;
                        else
                              step  =  0;
                  }


                  Set_Brightness(20);
                  WS2812_Send();


                  HAL_Delay(10);
                  i  +=  1;
                  if  (i  ==  MAX_LED)
   170   171   172   173   174   175   176   177   178   179   180