Sensor Data - first assignment CO838
Dependencies: mbed C12832 FXOS8700Q LM75B eCompass_FPU_Lib
Sensor Data - Project developed by Jean-Paul Saysana (jls44)
First assignment for the Internet of Things and Mobile Devices CO838 module
University of Kent (2016-2017)
Functionalities:
- Temperature Sensor
- Compass
- Music box
- Potentiometer that changes LED colours
Libraries used: C12832, eCompass_FPU_Lib, FXOS8700Q, LM75B
include/TemperatureSensor.h@1:c54902f21aa8, 2017-02-24 (annotated)
- Committer:
- co838_jls44
- Date:
- Fri Feb 24 14:33:41 2017 +0000
- Revision:
- 1:c54902f21aa8
- Parent:
- 0:4b83b332b327
comment about the playnote method
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
co838_jls44 | 0:4b83b332b327 | 1 | /* Developed by Jean-Paul Saysana - jls44 - MSc Student in Computer Security*/ |
co838_jls44 | 0:4b83b332b327 | 2 | /* Internet of Things and Mobile Devices - CO838 University of Kent*/ |
co838_jls44 | 0:4b83b332b327 | 3 | /* |
co838_jls44 | 0:4b83b332b327 | 4 | Class of the temperature sensor using the LM75B lib. |
co838_jls44 | 0:4b83b332b327 | 5 | It can read read ambiant temperature in Celsius or Fahrenheit. |
co838_jls44 | 0:4b83b332b327 | 6 | */ |
co838_jls44 | 0:4b83b332b327 | 7 | |
co838_jls44 | 0:4b83b332b327 | 8 | #ifndef TEMPERATURESENSOR_H_ |
co838_jls44 | 0:4b83b332b327 | 9 | #define TEMPERATURESENSOR_H_ |
co838_jls44 | 0:4b83b332b327 | 10 | |
co838_jls44 | 0:4b83b332b327 | 11 | |
co838_jls44 | 0:4b83b332b327 | 12 | #include "mbed.h" |
co838_jls44 | 0:4b83b332b327 | 13 | #include "LM75B/LM75B.h" |
co838_jls44 | 0:4b83b332b327 | 14 | |
co838_jls44 | 0:4b83b332b327 | 15 | class TemperatureSensor { |
co838_jls44 | 0:4b83b332b327 | 16 | public: |
co838_jls44 | 0:4b83b332b327 | 17 | TemperatureSensor(); |
co838_jls44 | 0:4b83b332b327 | 18 | ~TemperatureSensor() {}; |
co838_jls44 | 0:4b83b332b327 | 19 | |
co838_jls44 | 0:4b83b332b327 | 20 | /* Read the ambiant temperature */ |
co838_jls44 | 0:4b83b332b327 | 21 | float GetTemperature() const; |
co838_jls44 | 0:4b83b332b327 | 22 | |
co838_jls44 | 0:4b83b332b327 | 23 | /* Temperature different mode */ |
co838_jls44 | 0:4b83b332b327 | 24 | enum eTemp { CELSIUS, FAHRENHEIT }; |
co838_jls44 | 0:4b83b332b327 | 25 | |
co838_jls44 | 0:4b83b332b327 | 26 | /* Get Temperature mode, either Celsius or Fahrenheit */ |
co838_jls44 | 0:4b83b332b327 | 27 | eTemp GetMode() const; |
co838_jls44 | 0:4b83b332b327 | 28 | |
co838_jls44 | 0:4b83b332b327 | 29 | /* Set the mode in Celsius */ |
co838_jls44 | 0:4b83b332b327 | 30 | void SetCelsius(); |
co838_jls44 | 0:4b83b332b327 | 31 | /* Check if it's Celsius mode */ |
co838_jls44 | 0:4b83b332b327 | 32 | bool IsCelsius(); |
co838_jls44 | 0:4b83b332b327 | 33 | /* Set the mode in Fahrenheit */ |
co838_jls44 | 0:4b83b332b327 | 34 | void SetFahrenheit(); |
co838_jls44 | 0:4b83b332b327 | 35 | /* Check if it's Fahrenheit mode */ |
co838_jls44 | 0:4b83b332b327 | 36 | bool IsFahrenheit(); |
co838_jls44 | 0:4b83b332b327 | 37 | |
co838_jls44 | 0:4b83b332b327 | 38 | /* Switch between Celsius or Fahrenheit */ |
co838_jls44 | 0:4b83b332b327 | 39 | void SwitchMode(); |
co838_jls44 | 0:4b83b332b327 | 40 | |
co838_jls44 | 0:4b83b332b327 | 41 | private: |
co838_jls44 | 0:4b83b332b327 | 42 | /* Mode of the temperature */ |
co838_jls44 | 0:4b83b332b327 | 43 | eTemp temp_mode; |
co838_jls44 | 0:4b83b332b327 | 44 | }; |
co838_jls44 | 0:4b83b332b327 | 45 | |
co838_jls44 | 0:4b83b332b327 | 46 | #endif /* TEMPERATURESENSOR_H_ */ |