teste de publish

Dependencies:   DS1820 HighSpeedAnalogIn devices mbed

Committer:
brunofgc
Date:
Wed May 10 12:57:13 2017 +0000
Revision:
2:55b7b466e742
Parent:
1:0e0967c88590
Child:
7:ae9c47f62946
Ainda com bug em configRede.htm

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 1:0e0967c88590 15 printf("Found %d device(s)\r\n\n", num_temperatureSensors);
brunofgc 1:0e0967c88590 16 }
brunofgc 1:0e0967c88590 17
brunofgc 1:0e0967c88590 18 void refreshSensoresTemperatura(){
brunofgc 2:55b7b466e742 19 float aux;
brunofgc 1:0e0967c88590 20 if(num_temperatureSensors){
brunofgc 1:0e0967c88590 21 probe[0]->convertTemperature(true, DS1820::all_devices); //Start temperature conversion, wait until ready
brunofgc 1:0e0967c88590 22 for (int i = 0; i<num_temperatureSensors; i++){
brunofgc 2:55b7b466e742 23 if((aux = probe[i]->temperature()) != -1000.0){
brunofgc 2:55b7b466e742 24 temperaturas[i] = aux;
brunofgc 2:55b7b466e742 25 }
brunofgc 1:0e0967c88590 26 printf("Device %d returns %3.1foC\r\n", i, temperaturas[i]);
brunofgc 1:0e0967c88590 27 }
brunofgc 1:0e0967c88590 28 }
brunofgc 1:0e0967c88590 29 }
brunofgc 1:0e0967c88590 30
brunofgc 1:0e0967c88590 31 /*
brunofgc 1:0e0967c88590 32 while(1) {
brunofgc 1:0e0967c88590 33 probe[0]->convertTemperature(true, DS1820::all_devices); //Start temperature conversion, wait until ready
brunofgc 1:0e0967c88590 34 for (int i = 0; i<num_temperatureSensors; i++)
brunofgc 1:0e0967c88590 35 printf("Device %d returns %3.1foC\r\n", i, probe[i]->temperature());
brunofgc 1:0e0967c88590 36 wait(1);
brunofgc 1:0e0967c88590 37 }
brunofgc 1:0e0967c88590 38 */