Using mbed for sous vide
Dependencies: 4DGL-uLCD-SE DS1820 PinDetect Speaker mbed
Fork of DS18B20 by
main.cpp@0:03ec282c2908, 2010-01-29 (annotated)
- Committer:
- feabhas
- Date:
- Fri Jan 29 19:01:56 2010 +0000
- Revision:
- 0:03ec282c2908
- Child:
- 1:2d86c674a78b
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
feabhas | 0:03ec282c2908 | 1 | #include "mbed.h" |
feabhas | 0:03ec282c2908 | 2 | #include <stdint.h> |
feabhas | 0:03ec282c2908 | 3 | #include "DS18B20.h" |
feabhas | 0:03ec282c2908 | 4 | |
feabhas | 0:03ec282c2908 | 5 | DigitalInOut sensor(p5); // sensor connected to pin 5 |
feabhas | 0:03ec282c2908 | 6 | |
feabhas | 0:03ec282c2908 | 7 | Ticker timer; // used for our microsec timing |
feabhas | 0:03ec282c2908 | 8 | Serial pc(USBTX, USBRX); // serial comms over usb back to console |
feabhas | 0:03ec282c2908 | 9 | |
feabhas | 0:03ec282c2908 | 10 | int main() { |
feabhas | 0:03ec282c2908 | 11 | pc.printf("\n\r=====================================================\n\r"); |
feabhas | 0:03ec282c2908 | 12 | pc.printf("DS18B20 Configuration\n\r"); |
feabhas | 0:03ec282c2908 | 13 | sensor.mode(PullUp); |
feabhas | 0:03ec282c2908 | 14 | |
feabhas | 0:03ec282c2908 | 15 | ROM_Code_t ROM_Code = ReadROM(); |
feabhas | 0:03ec282c2908 | 16 | pc.printf("Family code: 0x%X\n\r", ROM_Code.BYTES.familyCode); |
feabhas | 0:03ec282c2908 | 17 | pc.printf("Serial Number: "); |
feabhas | 0:03ec282c2908 | 18 | for (uint32_t i = 6; i != 0; --i) { |
feabhas | 0:03ec282c2908 | 19 | pc.printf("%02X%s", ROM_Code.BYTES.serialNo[i-1], (i != 1)?":":"\r\n"); |
feabhas | 0:03ec282c2908 | 20 | } |
feabhas | 0:03ec282c2908 | 21 | pc.printf("CRC: 0x%X\r\n", ROM_Code.BYTES.CRC); |
feabhas | 0:03ec282c2908 | 22 | |
feabhas | 0:03ec282c2908 | 23 | pc.printf("\n\rRunning temperature conversion...\n\r"); |
feabhas | 0:03ec282c2908 | 24 | while (1) { |
feabhas | 0:03ec282c2908 | 25 | displayTemperature(pc); |
feabhas | 0:03ec282c2908 | 26 | wait(10); |
feabhas | 0:03ec282c2908 | 27 | } |
feabhas | 0:03ec282c2908 | 28 | } |
feabhas | 0:03ec282c2908 | 29 |