PIO IX 6° A TP1_ejercicio1 ALMADA, Santiago MAVER, Francisco

Dependencies:   mbed tsi_sensor DS1820

Revision:
5:ea823404aea8
Parent:
3:f483abe4bc57
Child:
6:3ebdc74fd68f
diff -r 01060b5e01b4 -r ea823404aea8 main.cpp
--- a/main.cpp	Fri Jan 13 18:30:37 2017 +0000
+++ b/main.cpp	Wed May 22 13:53:10 2019 +0000
@@ -1,42 +1,27 @@
-#define MULTIPLE_PROBES
-#define DATA_PIN        A0
-
-
-#ifdef MULTIPLE_PROBES
 
 #include "mbed.h"
 #include "DS1820.h"
+#include "tsi_sensor.h"
 
-#define MAX_PROBES      16
- 
-DS1820* probe[MAX_PROBES];
- 
-int main() {  
-    // Initialize the probe array to DS1820 objects
-    int num_devices = 0;
-    while(DS1820::unassignedProbe(DATA_PIN)) {
-        probe[num_devices] = new DS1820(DATA_PIN);
-        num_devices++;
-        if (num_devices == MAX_PROBES)
-            break;
-    }
-    
-    printf("Found %d device(s)\r\n\n", num_devices);
-    while(1) {
-        probe[0]->convertTemperature(true, DS1820::all_devices);         //Start temperature conversion, wait until ready
-        for (int i = 0; i<num_devices; i++)
-            printf("Device %d returns %3.1foC\r\n", i, probe[i]->temperature());
-        printf("\r\n");
-        wait(1);
-    }
-    
-}
+DS1820 probe(PTB0);
+
 
+/* 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
-#include "mbed.h"
-#include "DS1820.h"
- 
-DS1820 probe(DATA_PIN);
+#error TARGET NOT DEFINED
+#endif
+
+PwmOut salida1(LED_RED);
+TSIAnalogSlider tsi(ELEC0, ELEC1, 40);
+DigitalOut verde(LED_GREEN);
+DigitalOut azul(LED_BLUE);
+
  
 int main() {
     while(1) {
@@ -46,4 +31,4 @@
     }
 }
 
-#endif
\ No newline at end of file
+//#endif
\ No newline at end of file