david carpio
/
Deber_Analogo1
DEBER 1
Revision 0:1f531bcfb66a, committed 2019-01-17
- Comitter:
- davidcarpioc
- Date:
- Thu Jan 17 23:15:49 2019 +0000
- Commit message:
- DCARPIOH
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 000000000000 -r 1f531bcfb66a main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jan 17 23:15:49 2019 +0000 @@ -0,0 +1,18 @@ +#include "mbed.h" +#include <stdio.h> +Serial device(PA_2,PA_3); +AnalogIn sensor1(PC_1); +AnalogIn sensor2(PC_2); +DigitalOut led1(PD_12); +DigitalOut led2(PD_13); +float dato1,dato2; +int main() { device.baud(19200); led1=0; led2=0; + while(1) { + for(int x=1;x<=20;x=x+1){ + dato1=sensor1.read(); dato1=(dato1*120)+20; + dato2=sensor2.read(); dato2=(dato2*(-70))+80; + if(dato1>50){ led1=1; } + else { led1=0; } + if(dato2>50){ led2=0; } + else { led2=1; } + wait(0.5); } } } \ No newline at end of file
diff -r 000000000000 -r 1f531bcfb66a mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Jan 17 23:15:49 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/3a7713b1edbc \ No newline at end of file