Shinji Tadenuma
/
RGB_LED_PWM
RGB color LCD Test (PWM) for BlackOne
main.cpp@0:a22b8f104ce3, 2012-03-10 (annotated)
- Committer:
- techand
- Date:
- Sat Mar 10 11:09:18 2012 +0000
- Revision:
- 0:a22b8f104ce3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
techand | 0:a22b8f104ce3 | 1 | #include "mbed.h" |
techand | 0:a22b8f104ce3 | 2 | |
techand | 0:a22b8f104ce3 | 3 | //DigitalOut myled(LED1); |
techand | 0:a22b8f104ce3 | 4 | PwmOut blue(p24); |
techand | 0:a22b8f104ce3 | 5 | PwmOut green(p25); |
techand | 0:a22b8f104ce3 | 6 | PwmOut red(p26); |
techand | 0:a22b8f104ce3 | 7 | |
techand | 0:a22b8f104ce3 | 8 | int main() { |
techand | 0:a22b8f104ce3 | 9 | while(1) { |
techand | 0:a22b8f104ce3 | 10 | for(float p = 0.0f; p < 1.0f; p += 0.05f) { |
techand | 0:a22b8f104ce3 | 11 | blue = p; |
techand | 0:a22b8f104ce3 | 12 | green = 1 - p; |
techand | 0:a22b8f104ce3 | 13 | wait(0.04); |
techand | 0:a22b8f104ce3 | 14 | } |
techand | 0:a22b8f104ce3 | 15 | for(float p = 0.0f; p < 1.0f; p += 0.05f) { |
techand | 0:a22b8f104ce3 | 16 | red = p; |
techand | 0:a22b8f104ce3 | 17 | blue = 1 - p; |
techand | 0:a22b8f104ce3 | 18 | wait(0.04); |
techand | 0:a22b8f104ce3 | 19 | } |
techand | 0:a22b8f104ce3 | 20 | for(float p = 0.0f; p < 1.0f; p += 0.05f) { |
techand | 0:a22b8f104ce3 | 21 | green = p; |
techand | 0:a22b8f104ce3 | 22 | red = 1 - p; |
techand | 0:a22b8f104ce3 | 23 | wait(0.04); |
techand | 0:a22b8f104ce3 | 24 | } |
techand | 0:a22b8f104ce3 | 25 | } |
techand | 0:a22b8f104ce3 | 26 | } |