• 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;
     }

  • 相关阅读:
    Linux如何自动获取IP地址
    jq操作select集合
    UDP and TCP
    IPv6
    DHCP, NAT
    队列之顺序存储实现
    ARP, Fragmentation and Reassembly
    Classless Interdomain Routing (CIDR)
    Subnet Routing Examples
    Subnetting
  • 原文地址:https://www.cnblogs.com/xingxingye/p/12844531.html
Copyright © 2020-2023  润新知