#include "mbed.h"
#include "DS1820.h"
Serial serial(USBTX, USBRX);
int main() {
DS1820 ds1820(D4);
if(ds1820.begin()) {
ds1820.startConversion(); // start temperature conversion
wait(1.0); // let DS1820 complete the temperature conversion
while(1) {
serial.printf("temp=%3.1f\r\n", ds1820.read()); // read temperature
ds1820.startConversion(); // start temperature conversion
wait(1.0); // let DS1820 complete the temperature conversion
}
} else
serial.printf("No DS1820 sensor found!\r\n");
}
#include "mbed.h"
#include "DS1820.h"
Serial serial(USBTX, USBRX);
int main() {
DS1820 ds1820(D4);
if(ds1820.begin()) {
ds1820.startConversion(); // start temperature conversion
wait(1.0); // let DS1820 complete the temperature conversion
while(1) {
serial.printf("temp=%3.1f\r\n", ds1820.read()); // read temperature
ds1820.startConversion(); // start temperature conversion
wait(1.0); // let DS1820 complete the temperature conversion
}
} else
serial.printf("No DS1820 sensor found!\r\n");
}