Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of frdm_rgbled by
main.cpp@7:ad8295723268, 2014-07-16 (annotated)
- Committer:
- sam_grove
- Date:
- Wed Jul 16 10:20:45 2014 +0000
- Revision:
- 7:ad8295723268
- Parent:
- 5:14891bb08b35
- Child:
- 8:e282aa7c1fe9
update formatting and mbed library
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| chris | 0:cf8a48b1fb23 | 1 | #include "mbed.h" |
| chris | 0:cf8a48b1fb23 | 2 | |
| Kojto | 5:14891bb08b35 | 3 | PwmOut r(LED_RED); |
| Kojto | 5:14891bb08b35 | 4 | PwmOut g(LED_GREEN); |
| chris | 0:cf8a48b1fb23 | 5 | |
| sam_grove | 7:ad8295723268 | 6 | int main() |
| sam_grove | 7:ad8295723268 | 7 | { |
| sam_grove | 7:ad8295723268 | 8 | r.period(0.001f); |
| sam_grove | 7:ad8295723268 | 9 | g.period(0.001f); |
| chris | 1:eabc6f5b51d6 | 10 | |
| emilmont | 2:03e5c29343d1 | 11 | while (true) { |
| sam_grove | 7:ad8295723268 | 12 | for (float i = 0.0f; i < 1.0f ; i += 0.001f) { |
| chris | 1:eabc6f5b51d6 | 13 | float p = 3 * i; |
| sam_grove | 7:ad8295723268 | 14 | r = 1.0f - ((p < 1.0f) ? 1.0f - p : (p > 2.0f) ? p - 2.0f : 0.0f); |
| sam_grove | 7:ad8295723268 | 15 | g = 1.0f - ((p < 1.0f) ? p : (p > 2.0f) ? 0.0f : 2.0f - p); |
| sam_grove | 7:ad8295723268 | 16 | wait (0.0025f); |
| chris | 1:eabc6f5b51d6 | 17 | } |
| chris | 1:eabc6f5b51d6 | 18 | } |
| sam_grove | 7:ad8295723268 | 19 | } |
