![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Prueba programada de Lectura de sensores con ticker
Revision 0:df8af932325a, committed 2018-09-04
- Comitter:
- FNQ
- Date:
- Tue Sep 04 22:36:46 2018 +0000
- Commit message:
- Programa prueba de interrupciones programadas (ticker)
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BMP280.lib Tue Sep 04 22:36:46 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/FannyCalle/code/BMP280/#23149ed904d4
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Tue Sep 04 22:36:46 2018 +0000 @@ -0,0 +1,61 @@ +#include "mbed.h" +#include "BMP280.h" + + +I2C i2c(PB_4,PA_7); +BMP280 bmp(i2c,0xEC); //Default address = 0x76 + +AnalogIn temp2(PA_5); //sensor de temperatura externa +AnalogIn voltaje(PA_4); //sensor analogico de voltaje +AnalogIn corriente(PA_3); // sensor analogico de corriente +AnalogIn temp3(ADC_TEMP); //sensor de temperatura del arm + + +DigitalOut mylea(LED1); +DigitalOut myler(LED2); +Serial pr(USBTX,USBRX); +Timer timer1; +Ticker ticker1,ticker2,ticker3,ticker4,ticker5; +float prueba; +float prueba2; +float prueba3; + +void led1(){ + mylea= !mylea; + + } + +void led2(){ + myler=!myler; + } + +void tempe(){ + prueba=temp3.read(); + pr.printf("%f esta es la prueba \n",prueba); + + } +void temse(){ + prueba2=temp2.read(); + pr.printf("%f esta es la prueba es de sensores \n",prueba2); + + } + +void barome(){ + prueba3=bmp.getPressure(); + pr.printf("%f ESTA PRUEBA ES DE PRECION \n",prueba3); + + } + +int main() { + + ticker1.attach(&led1,0.5); + // ticker2.attach(&led2,1); + ticker3.attach(&tempe,0.3); + ticker4.attach(&temse,0.3); + ticker5.attach(&barome,0.5); + while(1) { + // prueba=temp3.read(); + // pr.printf("%f esta es la prueba \n",prueba); + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Sep 04 22:36:46 2018 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/e1686b8d5b90 \ No newline at end of file