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.
main.cpp@0:4e6dbadc83fc, 2013-06-13 (annotated)
- Committer:
- gu_420k
- Date:
- Thu Jun 13 10:41:24 2013 +0000
- Revision:
- 0:4e6dbadc83fc
- Child:
- 1:a8c211c1aff9
http://tech@ogata-lab.jp
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gu_420k | 0:4e6dbadc83fc | 1 | #include "mbed.h" |
gu_420k | 0:4e6dbadc83fc | 2 | #include "Serial.h" |
gu_420k | 0:4e6dbadc83fc | 3 | |
gu_420k | 0:4e6dbadc83fc | 4 | Serial pc(USBTX, USBRX); |
gu_420k | 0:4e6dbadc83fc | 5 | PwmOut r(p21), g(p22), b(p23); |
gu_420k | 0:4e6dbadc83fc | 6 | int main(){ |
gu_420k | 0:4e6dbadc83fc | 7 | r.period(0.02); |
gu_420k | 0:4e6dbadc83fc | 8 | g.period(0.02); |
gu_420k | 0:4e6dbadc83fc | 9 | b.period(0.02); |
gu_420k | 0:4e6dbadc83fc | 10 | |
gu_420k | 0:4e6dbadc83fc | 11 | r = 1; |
gu_420k | 0:4e6dbadc83fc | 12 | g = 1; |
gu_420k | 0:4e6dbadc83fc | 13 | b = 1; |
gu_420k | 0:4e6dbadc83fc | 14 | |
gu_420k | 0:4e6dbadc83fc | 15 | while(1){ |
gu_420k | 0:4e6dbadc83fc | 16 | char c=pc.getc(); |
gu_420k | 0:4e6dbadc83fc | 17 | switch(c){ |
gu_420k | 0:4e6dbadc83fc | 18 | case 'r': |
gu_420k | 0:4e6dbadc83fc | 19 | r = 0; |
gu_420k | 0:4e6dbadc83fc | 20 | g = 1; |
gu_420k | 0:4e6dbadc83fc | 21 | b = 1; |
gu_420k | 0:4e6dbadc83fc | 22 | break; |
gu_420k | 0:4e6dbadc83fc | 23 | case 'g': |
gu_420k | 0:4e6dbadc83fc | 24 | r = 1; |
gu_420k | 0:4e6dbadc83fc | 25 | g = 0; |
gu_420k | 0:4e6dbadc83fc | 26 | b = 1; |
gu_420k | 0:4e6dbadc83fc | 27 | break; |
gu_420k | 0:4e6dbadc83fc | 28 | case 'b': |
gu_420k | 0:4e6dbadc83fc | 29 | r = 1; |
gu_420k | 0:4e6dbadc83fc | 30 | g = 1; |
gu_420k | 0:4e6dbadc83fc | 31 | b = 0; |
gu_420k | 0:4e6dbadc83fc | 32 | break; |
gu_420k | 0:4e6dbadc83fc | 33 | } |
gu_420k | 0:4e6dbadc83fc | 34 | } |
gu_420k | 0:4e6dbadc83fc | 35 | } |