João Sousa
/
frdm_rgbled
wef
Revision 8:4bed841036f9, committed 2022-10-11
- Comitter:
- jotaemesousa
- Date:
- Tue Oct 11 21:19:03 2022 +0000
- Parent:
- 7:ad8295723268
- Commit message:
- ae; ;
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r ad8295723268 -r 4bed841036f9 main.cpp --- a/main.cpp Wed Jul 16 10:20:45 2014 +0000 +++ b/main.cpp Tue Oct 11 21:19:03 2022 +0000 @@ -2,18 +2,30 @@ PwmOut r(LED_RED); PwmOut g(LED_GREEN); +Serial pc(USBTX, USBRX); + +void RX_handler(void); int main() { r.period(0.001f); g.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); - wait (0.0025f); - } + r = 1; + g = 1; + + pc.attach(&RX_handler); + + while(1) + { + wait(0.2); } } + +void RX_handler(void) +{ + while(pc.readable()) + { + pc.putc(pc.getc()); + } +} \ No newline at end of file
diff -r ad8295723268 -r 4bed841036f9 mbed.bld --- a/mbed.bld Wed Jul 16 10:20:45 2014 +0000 +++ b/mbed.bld Tue Oct 11 21:19:03 2022 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/04dd9b1680ae \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/552587b429a1 \ No newline at end of file