Rock Monitoring  V 1.0
Sensors.h
Go to the documentation of this file.
1 #ifndef Sensors_H
2 #define Sensors_H
3 
4 #include "FXLS8471Q.h"
5 #include "WaspPWR.h"
6 #include "WaspConstants.h"
7 #include "WaspUSB.h"
8 #include "printable.h"
9 #include "Waspmote.h"
10 #include "PCT2075.h"
11 #include "../Constants/Constants.h"
12 class Sensors
13 {
14 public:
15 //typedefs
16  typedef struct //Struct with all 3 sensors containing the X, Y and Z values
17  {
22 
23  typedef struct //Struct with all 3 sensors containing the pitch and roll values
24  {
29 
30  typedef struct //Struct with all sensors values
31  {
35  int8_t sensTemp1;
36  int8_t sensTemp2;
37  int8_t sensTemp3;
38  int16_t extension;
39  uint8_t sensorNodeId;
40  uint8_t batteryLevel;
41  } structSensors;
42 
43 //methods
44  Sensors(); //constructor
45  void init(); //inits all sensors
46  uint8_t getSensorAcc123(Sensors::structSensorsXYZ * sensors123); //Gets the Acceleration values X, Y and Z from the 3 Accelerometers
47  uint8_t getSensorValues(Sensors::structSensors * allSensors); //reads the pitch and Roll Angle- Values of all 3 Accelerometers, all 3 temperatures and the extension
48  void print(); //reads the X, Y and Z - Values of all 3 Accelerometers, reads the extensiomter and prints all the received data
49  void printAll(); //reads all sensor data and prints it
50 
51  void getExtension(int & extension); //reads the extension in 1/10 mm
52  void goToSleep(); //sets all sensors in Standby
53  void wakeUp(); //wakes up all sensors
54 
55 private:
56 //attributes
63 
64 //methods
65  int median(int n, int x[]); //calculates median value of numbers in array
66 
67 };
68 #endif /* Sensors_H */
69 
void print()
This method reads the X, Y and Z - Values of all 3 Accelerometers and the extensiomter and prints the...
Definition: Sensors.cpp:161
uint8_t sensorNodeId
Definition: Sensors.h:39
FXLS8471Q acc2
Definition: Sensors.h:58
void printAll()
This method reads all the sensors and prints them to the serial Port.
Definition: Sensors.cpp:212
FXLS8471Q::structPitchRoll sensor3
Definition: Sensors.h:34
void wakeUp()
This method is used to wake up the Sensors, it initializes them.
Definition: Sensors.cpp:289
Class that handles the communication to the temperature sensor PCT2075.
Definition: PCT2075.h:29
FXLS8471Q::structPitchRoll sensor3
Definition: Sensors.h:27
FXLS8471Q::structPitchRoll sensor1
Definition: Sensors.h:32
PCT2075 temp2
Definition: Sensors.h:61
FXLS8471Q acc1
Definition: Sensors.h:57
uint8_t getSensorValues(Sensors::structSensors *allSensors)
This method reads the pitch and Roll Angle- Values of all 3 Accelerometers, all 3 temperatures and th...
Definition: Sensors.cpp:77
void goToSleep()
This method sets all sensors in Standby.
Definition: Sensors.cpp:278
int median(int n, int x[])
This method calculates the median value of the elements in the array.
Definition: Sensors.cpp:299
uint8_t getSensorAcc123(Sensors::structSensorsXYZ *sensors123)
This method gives back the X, Y and Z - Values of all 3 Accelerometers.
Definition: Sensors.cpp:35
Class that handles the communication to the Accelerometer FXLS8471Q.
Definition: FXLS8471Q.h:26
PCT2075 temp1
Definition: Sensors.h:60
void getExtension(int &extension)
This method reads the Extension of the potentiometer, it uses the 10Bit- ADC Converter it calculates...
Definition: Sensors.cpp:265
PCT2075 temp3
Definition: Sensors.h:62
FXLS8471Q acc3
Definition: Sensors.h:59
Class that handles sensors.
Definition: Sensors.h:12
FXLS8471Q::structPitchRoll sensor2
Definition: Sensors.h:26
FXLS8471Q::structPitchRoll sensor2
Definition: Sensors.h:33
FXLS8471Q::structPitchRoll sensor1
Definition: Sensors.h:25
Sensors()
Definition: Sensors.cpp:6
void init()
This method initializes the sensors.
Definition: Sensors.cpp:15
FXLS8471Q::structXYZ sensor2
Definition: Sensors.h:19
FXLS8471Q::structXYZ sensor3
Definition: Sensors.h:20
FXLS8471Q::structXYZ sensor1
Definition: Sensors.h:18
uint8_t batteryLevel
Definition: Sensors.h:40