Emanuel Jalle
/
EJ6ELMISMOPERSUBIDOXD
COMMIT EMA APROBA CONTROL
Revision 0:8cb354c51016, committed 2019-11-28
- Comitter:
- Jalle
- Date:
- Thu Nov 28 03:36:27 2019 +0000
- Commit message:
- COMMIT EMA TE QUEREMOS
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 8cb354c51016 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Nov 28 03:36:27 2019 +0000 @@ -0,0 +1,43 @@ +#include "mbed.h" +#include "tsi_sensor.h" + +/* This defines will be replaced by PinNames soon */ +#if defined (TARGET_KL25Z) || defined (TARGET_KL46Z) + #define ELEC0 9 + #define ELEC1 10 +#elif defined (TARGET_KL05Z) + #define ELEC0 9 + #define ELEC1 8 +#else + #error TARGET NOT DEFINED +#endif +DigitalOut ledazul(LED_BLUE); +DigitalOut ledverde(LED_GREEN); +DigitalOut ledrojo(LED_RED); +double a=0; +int main(void) { + + TSIAnalogSlider tsi(ELEC0, ELEC1, 100); + + while (true) { + a=tsi.readPercentage(); + if(a>=0.35&&a<=0.65){ + ledazul=0; + } + else + ledazul=1; + + if(a<0.30&&a>0){ + ledverde=0; + } + else + ledverde=1; + + if(a>0.70){ + ledrojo=0; + } + else + ledrojo=1; + + } +}
diff -r 000000000000 -r 8cb354c51016 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Nov 28 03:36:27 2019 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file