Vincent Wochnik
/
app-shield-RGB
fds
Fork of app-shield-RGB by
Revision 2:dd290a3fe641, committed 2014-02-18
- Comitter:
- vwochnik
- Date:
- Tue Feb 18 17:01:14 2014 +0000
- Parent:
- 1:5ac8fa71dfb4
- Commit message:
- f
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 5ac8fa71dfb4 -r dd290a3fe641 main.cpp --- a/main.cpp Fri Feb 07 17:28:21 2014 +0000 +++ b/main.cpp Tue Feb 18 17:01:14 2014 +0000 @@ -1,19 +1,29 @@ #include "mbed.h" +/// +/// +/// EINMAL TESTEN MIT UND OHNE DEFINES. +/// EINMAL TESTEN MIT period und wenn geht ohne. +/// +/// +#define D5 P2_1 +#define D8 P2_4 +#define D9 P2_3 + PwmOut r (D5); PwmOut g (D8); PwmOut b (D9); +int state = 0; int main() { + // teste mit und auskommentiert was soll das nur fr r? r.period(0.001); while(1) { - for(float i = 0.0; i < 1.0 ; i += 0.001) { - float p = 3 * i; - r = 1.0 - ((p < 1.0) ? 1.0 - p : (p > 2.0) ? p - 2.0 : 0.0); - g = 1.0 - ((p < 1.0) ? p : (p > 2.0) ? 0.0 : 2.0 - p); - b = 1.0 - ((p < 1.0) ? 0.0 : (p > 2.0) ? 3.0 - p : p - 1.0); ; - wait (0.01); - } + r = 1.0 - ((state == 0) ? 1.0 : 0.0); + g = 1.0 - ((state == 0) ? 1.0 : 0.0); + b = 1.0 - ((state == 0) ? 1.0 : 0.0); + if (++state == 3) state = 0; + wait (0.33); } } \ No newline at end of file