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.
Revision 1:0292d339c0ba, committed 2016-02-19
- Comitter:
- through
- Date:
- Fri Feb 19 14:42:34 2016 +0000
- Parent:
- 0:985d8bf2626d
- Commit message:
- iluminacion 2
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Feb 19 13:18:25 2016 +0000 +++ b/main.cpp Fri Feb 19 14:42:34 2016 +0000 @@ -1,16 +1,36 @@ #include "mbed.h" - +Serial bt (PTE22, PTE23); +Serial pc(USBTX,USBRX); PwmOut out(D3); -AnalogIn pot(D2); -int a=0; +AnalogIn pot(A0); +int x=0; int main() { while(1) { - a=pot; - out=a/1026; + if(bt.readable()){ + x=bt.getc(); + //bt.scanf("%c",&x); + //wait(0.2); + //pc.printf("%c\n",x); + + + if(x=='1'){ + out=0.3; + } + if(x=='2'){ + out=0.6; + } + if(x=='3'){ + out=1; + } + if(x=='0'){ + out=0; + } + } + wait(0.1); }