PIO IX 6° A TP1_ejercicio1 ALMADA, Santiago MAVER, Francisco
Dependencies: mbed tsi_sensor DS1820
main.cpp@5:ea823404aea8, 2019-05-22 (annotated)
- Committer:
- Franmaver
- Date:
- Wed May 22 13:53:10 2019 +0000
- Revision:
- 5:ea823404aea8
- Parent:
- 3:f483abe4bc57
- Child:
- 6:3ebdc74fd68f
FUNCIONANDO HASTA ACA;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sissors | 0:e069f9f26768 | 1 | |
Sissors | 0:e069f9f26768 | 2 | #include "mbed.h" |
Sissors | 0:e069f9f26768 | 3 | #include "DS1820.h" |
Franmaver | 5:ea823404aea8 | 4 | #include "tsi_sensor.h" |
Sissors | 0:e069f9f26768 | 5 | |
Franmaver | 5:ea823404aea8 | 6 | DS1820 probe(PTB0); |
Franmaver | 5:ea823404aea8 | 7 | |
Sissors | 0:e069f9f26768 | 8 | |
Franmaver | 5:ea823404aea8 | 9 | /* This defines will be replaced by PinNames soon */ |
Franmaver | 5:ea823404aea8 | 10 | #if defined (TARGET_KL25Z) || defined (TARGET_KL46Z) |
Franmaver | 5:ea823404aea8 | 11 | #define ELEC0 9 |
Franmaver | 5:ea823404aea8 | 12 | #define ELEC1 10 |
Franmaver | 5:ea823404aea8 | 13 | #elif defined (TARGET_KL05Z) |
Franmaver | 5:ea823404aea8 | 14 | #define ELEC0 9 |
Franmaver | 5:ea823404aea8 | 15 | #define ELEC1 8 |
Sissors | 0:e069f9f26768 | 16 | #else |
Franmaver | 5:ea823404aea8 | 17 | #error TARGET NOT DEFINED |
Franmaver | 5:ea823404aea8 | 18 | #endif |
Franmaver | 5:ea823404aea8 | 19 | |
Franmaver | 5:ea823404aea8 | 20 | PwmOut salida1(LED_RED); |
Franmaver | 5:ea823404aea8 | 21 | TSIAnalogSlider tsi(ELEC0, ELEC1, 40); |
Franmaver | 5:ea823404aea8 | 22 | DigitalOut verde(LED_GREEN); |
Franmaver | 5:ea823404aea8 | 23 | DigitalOut azul(LED_BLUE); |
Franmaver | 5:ea823404aea8 | 24 | |
Sissors | 0:e069f9f26768 | 25 | |
Sissors | 0:e069f9f26768 | 26 | int main() { |
Sissors | 0:e069f9f26768 | 27 | while(1) { |
Sissors | 0:e069f9f26768 | 28 | probe.convertTemperature(true, DS1820::all_devices); //Start temperature conversion, wait until ready |
Sissors | 0:e069f9f26768 | 29 | printf("It is %3.1foC\r\n", probe.temperature()); |
Sissors | 0:e069f9f26768 | 30 | wait(1); |
Sissors | 0:e069f9f26768 | 31 | } |
Sissors | 0:e069f9f26768 | 32 | } |
Sissors | 0:e069f9f26768 | 33 | |
Franmaver | 5:ea823404aea8 | 34 | //#endif |