Part One of my Project Course. Implementation of simple I/O and a custom defined protocol over UDP/IP.
Dependencies: C12832 LM75B mbed EthernetInterface mbed-rtos
temperature.cpp@3:538e17979246, 2018-03-23 (annotated)
- Committer:
- bertgereels
- Date:
- Fri Mar 23 13:42:13 2018 +0000
- Revision:
- 3:538e17979246
- Parent:
- 0:88d3b9015f7c
Cleared response array before constructing ack.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bertgereels | 0:88d3b9015f7c | 1 | #include "mbed.h" |
bertgereels | 0:88d3b9015f7c | 2 | #include "LM75B.h" |
bertgereels | 0:88d3b9015f7c | 3 | #include "C12832.h" |
bertgereels | 0:88d3b9015f7c | 4 | #include "temperature.h" |
bertgereels | 0:88d3b9015f7c | 5 | |
bertgereels | 0:88d3b9015f7c | 6 | namespace ProjectOne{ |
bertgereels | 0:88d3b9015f7c | 7 | |
bertgereels | 0:88d3b9015f7c | 8 | Temperature::Temperature(PinName firstPin, PinName secondPin) : sensor(firstPin,secondPin){ |
bertgereels | 0:88d3b9015f7c | 9 | |
bertgereels | 0:88d3b9015f7c | 10 | } |
bertgereels | 0:88d3b9015f7c | 11 | |
bertgereels | 0:88d3b9015f7c | 12 | float Temperature::readTemperature(void){ |
bertgereels | 0:88d3b9015f7c | 13 | if (sensor.open()) { |
bertgereels | 0:88d3b9015f7c | 14 | return (float)sensor.temp(); |
bertgereels | 0:88d3b9015f7c | 15 | }else{ |
bertgereels | 0:88d3b9015f7c | 16 | return -1; |
bertgereels | 0:88d3b9015f7c | 17 | } |
bertgereels | 0:88d3b9015f7c | 18 | } |
bertgereels | 0:88d3b9015f7c | 19 | |
bertgereels | 0:88d3b9015f7c | 20 | } |