Sushil Dangiya
/
test1
gjgfadjsgfodsafkjsdof
Diff: main.cpp
- Revision:
- 0:2db3563168ff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Dec 03 06:50:49 2016 +0000 @@ -0,0 +1,20 @@ +#include "mbed.h" + +PwmOut r(PTB18); +PwmOut g(PTB19); +PwmOut b(PTD1); +int main() +{ + r.period(0.001f); + g.period(0.001f); + b.period(0.001f); + while (true) { + for (float i = 0.0f; i < 1.0f ; i += 0.001f) { + float p = 3 * i; + r = 1.0f - ((p < 1.0f) ? 1.0f - p : (p > 2.0f) ? p - 2.0f : 0.0f); + g = 1.0f - ((p < 1.0f) ? p : (p > 2.0f) ? 0.0f : 2.0f - p); + b = 1.0f - ((p < 1.0f) ? p : (p > 2.0f) ? 0.0f : 2.0f - p); + wait (0.0025f); + } + } +}