teste de publish

Dependencies:   DS1820 HighSpeedAnalogIn devices mbed

Committer:
brunofgc
Date:
Fri Jun 08 22:14:21 2018 +0000
Revision:
38:07d3907b74e5
Parent:
21:b9315cdd9275
teste de publish para compilar no mbed-cli

Who changed what in which revision?

UserRevisionLine numberNew contents of line
brunofgc 1:0e0967c88590 1 #include "DS18B20_SensorTemperatura.h"
brunofgc 1:0e0967c88590 2
brunofgc 1:0e0967c88590 3 DS1820* probe[MAX_PROBES];
brunofgc 1:0e0967c88590 4 int num_temperatureSensors = 0;
brunofgc 1:0e0967c88590 5 float temperaturas[MAX_PROBES];
brunofgc 1:0e0967c88590 6
brunofgc 1:0e0967c88590 7 void inicializaSensoresTemperatura(){
brunofgc 1:0e0967c88590 8 // Initialize the probe array to DS1820 objects
brunofgc 1:0e0967c88590 9 while(DS1820::unassignedProbe(DATA_PIN)) {
brunofgc 1:0e0967c88590 10 probe[num_temperatureSensors] = new DS1820(DATA_PIN);
brunofgc 1:0e0967c88590 11 num_temperatureSensors++;
brunofgc 1:0e0967c88590 12 if (num_temperatureSensors == MAX_PROBES)
brunofgc 1:0e0967c88590 13 break;
brunofgc 1:0e0967c88590 14 }
brunofgc 15:0f78bf9c13ec 15 printf("Found %d device(s)\r\n\n", num_temperatureSensors);
brunofgc 15:0f78bf9c13ec 16 refreshSensoresTemperatura();
brunofgc 1:0e0967c88590 17 }
brunofgc 1:0e0967c88590 18
brunofgc 1:0e0967c88590 19 void refreshSensoresTemperatura(){
brunofgc 2:55b7b466e742 20 float aux;
brunofgc 1:0e0967c88590 21 if(num_temperatureSensors){
brunofgc 1:0e0967c88590 22 probe[0]->convertTemperature(true, DS1820::all_devices); //Start temperature conversion, wait until ready
brunofgc 1:0e0967c88590 23 for (int i = 0; i<num_temperatureSensors; i++){
brunofgc 2:55b7b466e742 24 if((aux = probe[i]->temperature()) != -1000.0){
brunofgc 2:55b7b466e742 25 temperaturas[i] = aux;
brunofgc 2:55b7b466e742 26 }
brunofgc 21:b9315cdd9275 27 if(debug){printf("Device %d returns %3.1foC\r\n", i, temperaturas[i]);}
brunofgc 1:0e0967c88590 28 }
brunofgc 1:0e0967c88590 29 }
brunofgc 1:0e0967c88590 30 }
brunofgc 15:0f78bf9c13ec 31