![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
4589
Dependencies: mbed
Revision 0:c65497674c14, committed 2017-12-11
- Comitter:
- erick_em
- Date:
- Mon Dec 11 16:49:21 2017 +0000
- Commit message:
- pot
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Dec 11 16:49:21 2017 +0000 @@ -0,0 +1,56 @@ +#include "mbed.h" + +AnalogIn a1(A0); +BusOut M1(D2,D3,D4,D5); +Serial pc(USBTX,USBRX); //para leer serial y mandarlo a la PC + +char pos[4]={0x0A,0x09,0x05,0x06}; +char pos2[4]={0x05,0x09,0x0A,0x06}; +int i; +int j; +int k; +char l; + +int main() +{ + i=0; + j=0; + k=0; + + + while (1) + { + + j=248*a1.read(); + wait(0.01); + /* l=l+j; + j=0; + j=248*a1.read(); + wait(0.005); + l=l+j; + j=0; + l=l/2; + j=l; + */ + + printf(" = %d\n",j); + + // pc.getc(); + if(k<j) + { + M1=pos[i]; + wait(0.003); + i++; + k++; + if(i==4) {i=0;} + } + if(k>j) + { + M1=pos2[i]; + wait(0.003); + i++; + k--; + if(i==4) {i=0;} + } + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Dec 11 16:49:21 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/fb8e0ae1cceb \ No newline at end of file