Driver for TMP06 temperature sensor. Data is sent by PWM. Tested on Hani-IoT board with TMP06BRTZ sensor.
Example usage
main.cpp
#include "mbed.h" #include "TMP06.h" int main() { TMP06 temp_sensor(P0_1); float temperature; while (true) { if(temp_sensor.read(&temperature) == SUCCESS) { printf("Temperature: %f\n", temperature); } else { printf("Error!\n"); } ThisThread::sleep_for(2000); } }
Diff: TMP06.cpp
- Revision:
- 1:82fcfd05add8
- Parent:
- 0:cee46eec60a8
- Child:
- 2:1ff2f041925a
diff -r cee46eec60a8 -r 82fcfd05add8 TMP06.cpp --- a/TMP06.cpp Tue Feb 25 11:30:44 2020 +0100 +++ b/TMP06.cpp Tue Feb 25 11:36:34 2020 +0100 @@ -1,3 +1,5 @@ +/* Copyright (C) 2020 Arrow Electronics */ + #include "TMP06.h" TMP06::TMP06(PinName pin) : _pwm_pin(pin), _semaphore(0, 1)