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/SensorData.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 | /* Class SensorData which is the main class of this project*/ |
co838_jls44 | 0:4b83b332b327 | 4 | |
co838_jls44 | 0:4b83b332b327 | 5 | #ifndef SENSORDATA_H_ |
co838_jls44 | 0:4b83b332b327 | 6 | #define SENSORDATA_H_ |
co838_jls44 | 0:4b83b332b327 | 7 | |
co838_jls44 | 0:4b83b332b327 | 8 | #include "mbed.h" |
co838_jls44 | 0:4b83b332b327 | 9 | |
co838_jls44 | 0:4b83b332b327 | 10 | #include "LCD.h" |
co838_jls44 | 0:4b83b332b327 | 11 | #include "TemperatureSensor.h" |
co838_jls44 | 0:4b83b332b327 | 12 | #include "Speaker.h" |
co838_jls44 | 0:4b83b332b327 | 13 | #include "Compass.h" |
co838_jls44 | 0:4b83b332b327 | 14 | #include "LED.h" |
co838_jls44 | 0:4b83b332b327 | 15 | |
co838_jls44 | 0:4b83b332b327 | 16 | class SensorData { |
co838_jls44 | 0:4b83b332b327 | 17 | public: |
co838_jls44 | 0:4b83b332b327 | 18 | SensorData(); |
co838_jls44 | 0:4b83b332b327 | 19 | ~SensorData() {}; |
co838_jls44 | 0:4b83b332b327 | 20 | |
co838_jls44 | 0:4b83b332b327 | 21 | void Start(); |
co838_jls44 | 0:4b83b332b327 | 22 | |
co838_jls44 | 0:4b83b332b327 | 23 | enum ePage { TEMPERATURE = 0, COMPASS = 1, MUSIC = 2, ENTER_TEMP = 3, |
co838_jls44 | 0:4b83b332b327 | 24 | ENTER_COMPASS = 4 }; |
co838_jls44 | 0:4b83b332b327 | 25 | |
co838_jls44 | 0:4b83b332b327 | 26 | |
co838_jls44 | 0:4b83b332b327 | 27 | private: |
co838_jls44 | 0:4b83b332b327 | 28 | void MainLoop(); |
co838_jls44 | 0:4b83b332b327 | 29 | void MenuSelection(); |
co838_jls44 | 0:4b83b332b327 | 30 | |
co838_jls44 | 0:4b83b332b327 | 31 | void InitCommand(); |
co838_jls44 | 0:4b83b332b327 | 32 | void ChangePosition(); |
co838_jls44 | 0:4b83b332b327 | 33 | void Up(); |
co838_jls44 | 0:4b83b332b327 | 34 | void Down(); |
co838_jls44 | 0:4b83b332b327 | 35 | void Enter(); |
co838_jls44 | 0:4b83b332b327 | 36 | void Pause(); |
co838_jls44 | 0:4b83b332b327 | 37 | void Back(); |
co838_jls44 | 0:4b83b332b327 | 38 | |
co838_jls44 | 0:4b83b332b327 | 39 | void SwitchPause(); |
co838_jls44 | 0:4b83b332b327 | 40 | |
co838_jls44 | 0:4b83b332b327 | 41 | /* LCD object */ |
co838_jls44 | 0:4b83b332b327 | 42 | LCD lcd; |
co838_jls44 | 0:4b83b332b327 | 43 | |
co838_jls44 | 0:4b83b332b327 | 44 | /* Temperature sensor object */ |
co838_jls44 | 0:4b83b332b327 | 45 | TemperatureSensor ts; |
co838_jls44 | 0:4b83b332b327 | 46 | /* Print temperature in the LCD screen */ |
co838_jls44 | 0:4b83b332b327 | 47 | void DisplayTemperature(); |
co838_jls44 | 0:4b83b332b327 | 48 | /* Delay to get data */ |
co838_jls44 | 0:4b83b332b327 | 49 | float delay; |
co838_jls44 | 0:4b83b332b327 | 50 | |
co838_jls44 | 0:4b83b332b327 | 51 | |
co838_jls44 | 0:4b83b332b327 | 52 | /* Speaker */ |
co838_jls44 | 0:4b83b332b327 | 53 | Speaker speaker; |
co838_jls44 | 0:4b83b332b327 | 54 | |
co838_jls44 | 0:4b83b332b327 | 55 | /* Compass */ |
co838_jls44 | 0:4b83b332b327 | 56 | Compass compass; |
co838_jls44 | 0:4b83b332b327 | 57 | void DisplayCompass(); |
co838_jls44 | 0:4b83b332b327 | 58 | |
co838_jls44 | 0:4b83b332b327 | 59 | /* LED */ |
co838_jls44 | 0:4b83b332b327 | 60 | LED led; |
co838_jls44 | 0:4b83b332b327 | 61 | void ChangeLED(); |
co838_jls44 | 0:4b83b332b327 | 62 | |
co838_jls44 | 0:4b83b332b327 | 63 | /* Menu */ |
co838_jls44 | 0:4b83b332b327 | 64 | int pos; |
co838_jls44 | 0:4b83b332b327 | 65 | ePage epage; |
co838_jls44 | 0:4b83b332b327 | 66 | |
co838_jls44 | 0:4b83b332b327 | 67 | /* quit variable, if quit == 3, quit the program. */ |
co838_jls44 | 0:4b83b332b327 | 68 | int quit; |
co838_jls44 | 0:4b83b332b327 | 69 | |
co838_jls44 | 0:4b83b332b327 | 70 | /* Pause variable */ |
co838_jls44 | 0:4b83b332b327 | 71 | bool pause_sensor; |
co838_jls44 | 0:4b83b332b327 | 72 | }; |
co838_jls44 | 0:4b83b332b327 | 73 | |
co838_jls44 | 0:4b83b332b327 | 74 | #endif /* SENSORDATA_H_ */ |