zoukankan      html  css  js  c++  java
  • RGBIO控制

    红  绿    蓝      颜色

    1    0     0        红

    0    1     0        绿

    1    1     0        黄

    0    0     1        蓝

    1    0     1        紫

    0    1     1        浅蓝

    1    1     1        白

    颜色变化:红 -> 黄 -> 绿 -> 浅蓝 -> 蓝 -> 紫 -> 白

                     100  |110  | 010  | 011   | 001 | 101 |111

    if((PWM_Coloured_RED_Flag==0)&&(PWM_Coloured_GREEN_Flag==0))
     {
      PWM_Coloured_RED_Value--;
      if(PWM_Coloured_RED_Value<=0)
      PWM_Coloured_RED_Flag=1;
     }
     if((PWM_Coloured_RED_Flag==1)&&(PWM_Coloured_GREEN_Flag==0))
     {
      PWM_Coloured_GREEN_Value--;
      if(PWM_Coloured_GREEN_Value<=0)
      PWM_Coloured_GREEN_Flag=1;
     }
     if((PWM_Coloured_RED_Flag==1)&&(PWM_Coloured_GREEN_Flag==1)&&(PWM_Coloured_BLUE_Flag==0))
     {
      PWM_Coloured_RED_Value++;
      if(PWM_Coloured_RED_Value>=100)
      PWM_Coloured_RED_Flag=0;
     }
     if((PWM_Coloured_RED_Flag==0)&&(PWM_Coloured_GREEN_Flag==1)&&(PWM_Coloured_BLUE_Flag==0))
     {
      PWM_Coloured_BLUE_Value--;
      if(PWM_Coloured_BLUE_Value<=0)
      PWM_Coloured_BLUE_Flag=1;
     }
     if((PWM_Coloured_RED_Flag==0)&&(PWM_Coloured_GREEN_Flag==1)&&(PWM_Coloured_BLUE_Flag==1))
     {
      PWM_Coloured_GREEN_Value++;
      if(PWM_Coloured_GREEN_Value>=100)
      PWM_Coloured_GREEN_Flag=0;
     }
     if((PWM_Coloured_RED_Flag==1)&&(PWM_Coloured_GREEN_Flag==1)&&(PWM_Coloured_BLUE_Flag==1))
     {
      PWM_Coloured_GREEN_Value++;
      if(PWM_Coloured_GREEN_Value>=100)
      PWM_Coloured_GREEN_Flag=0;
      
      PWM_Coloured_BLUE_Value++;
      if(PWM_Coloured_BLUE_Value>=100)
      PWM_Coloured_BLUE_Flag=0;
     }

  • 相关阅读:
    性能测试学习笔记目录
    关于多项式的一些东西
    几道有意思的积性函数题
    关于min_25筛的一些理解
    【清华集训2014】主旋律
    清北冬令营训练计划
    # HNOI2012 ~ HNOI2018 题解
    贪心(qwq)习题题解
    导数与积分总结
    仙人掌 && 圆方树 && 虚树 总结
  • 原文地址:https://www.cnblogs.com/xingxingye/p/12844531.html
Copyright © 2011-2022 走看看