![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
gjgfadjsgfodsafkjsdof
main.cpp@0:2db3563168ff, 2016-12-03 (annotated)
- Committer:
- DSPMARCO
- Date:
- Sat Dec 03 06:50:49 2016 +0000
- Revision:
- 0:2db3563168ff
my test1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DSPMARCO | 0:2db3563168ff | 1 | #include "mbed.h" |
DSPMARCO | 0:2db3563168ff | 2 | |
DSPMARCO | 0:2db3563168ff | 3 | PwmOut r(PTB18); |
DSPMARCO | 0:2db3563168ff | 4 | PwmOut g(PTB19); |
DSPMARCO | 0:2db3563168ff | 5 | PwmOut b(PTD1); |
DSPMARCO | 0:2db3563168ff | 6 | int main() |
DSPMARCO | 0:2db3563168ff | 7 | { |
DSPMARCO | 0:2db3563168ff | 8 | r.period(0.001f); |
DSPMARCO | 0:2db3563168ff | 9 | g.period(0.001f); |
DSPMARCO | 0:2db3563168ff | 10 | b.period(0.001f); |
DSPMARCO | 0:2db3563168ff | 11 | while (true) { |
DSPMARCO | 0:2db3563168ff | 12 | for (float i = 0.0f; i < 1.0f ; i += 0.001f) { |
DSPMARCO | 0:2db3563168ff | 13 | float p = 3 * i; |
DSPMARCO | 0:2db3563168ff | 14 | r = 1.0f - ((p < 1.0f) ? 1.0f - p : (p > 2.0f) ? p - 2.0f : 0.0f); |
DSPMARCO | 0:2db3563168ff | 15 | g = 1.0f - ((p < 1.0f) ? p : (p > 2.0f) ? 0.0f : 2.0f - p); |
DSPMARCO | 0:2db3563168ff | 16 | b = 1.0f - ((p < 1.0f) ? p : (p > 2.0f) ? 0.0f : 2.0f - p); |
DSPMARCO | 0:2db3563168ff | 17 | wait (0.0025f); |
DSPMARCO | 0:2db3563168ff | 18 | } |
DSPMARCO | 0:2db3563168ff | 19 | } |
DSPMARCO | 0:2db3563168ff | 20 | } |