1
1
#include " Arduino_Sensorkit.h"
2
2
3
-
4
3
// Declare component's classes
5
4
U8G2_SSD1306_128X64_NONAME_F_SW_I2C Oled (U8G2_R0, SCL, SDA, U8X8_PIN_NONE);
6
5
DHT Environment (DHTPIN, DHTTYPE);
@@ -28,118 +27,4 @@ bool SensorKit::begin(){
28
27
29
28
void SensorKit::end (){
30
29
31
- }
32
-
33
-
34
-
35
-
36
- // Old version
37
-
38
- /*
39
- // ++++++++++++++++++++++++++++++++++++++
40
- // Functions related to the Accelerometer
41
- // ++++++++++++++++++++++++++++++++++++++
42
-
43
- void BreakoutBoard::init_Accelerometer(){
44
-
45
- ACCELEROMETER.begin(WIRE, 0x19);
46
- delay(100);
47
- ACCELEROMETER.setFullScaleRange(LIS3DHTR_RANGE_2G);
48
- ACCELEROMETER.setOutputDataRate(LIS3DHTR_DATARATE_50HZ);
49
- Serial.println("Accelerometer Connected !");
50
-
51
- }
52
-
53
- float BreakoutBoard::getAccelerationValue(char axis){
54
-
55
- switch(axis)
56
- {
57
- case 'X':
58
- return ACCELEROMETER.getAccelerationX();
59
- case 'Y':
60
- return ACCELEROMETER.getAccelerationY();
61
- case 'Z':
62
- return ACCELEROMETER.getAccelerationY();
63
- default :
64
- Serial.print("Invalid Input");
65
- while(1);
66
- break ;
67
- }
68
-
69
- }
70
-
71
- // ++++++++++++++++++++++++++++++++++++++++
72
- // Functions related to the Pressure Sensor
73
- // ++++++++++++++++++++++++++++++++++++++++
74
-
75
- void BreakoutBoard::init_PressureSensor() {
76
-
77
- if (!bmp280.init()) {
78
- Serial.println("Device not connected or broken!");
79
- }
80
- else {
81
- Serial.println("Pressure Sensor Connected !");
82
- }
83
- }
84
-
85
- float BreakoutBoard::getPressureValue() {
86
- return bmp280.getPressure();
87
- }
88
-
89
- float BreakoutBoard::getAltitudeValue() {
90
- return bmp280.calcAltitude( bmp280.getPressure());
91
- }
92
-
93
- // ++++++++++++++++++++++++++++++++++++++++
94
- // Functions related to the OLED Screen
95
- // ++++++++++++++++++++++++++++++++++++++++
96
-
97
- void BreakoutBoard::init_OLEDScreen(){
98
-
99
- u8g2.begin();
100
- u8g2.setFont(u8g2_font_ncenB08_tr); // set a suitable font
101
-
102
- }
103
-
104
- void BreakoutBoard::setLabel(char *s){
105
-
106
- u8g2.clearBuffer(); // clear the internal memory
107
- u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
108
- u8g2.drawStr(0,10,s);
109
- //u8g2.print(a); // print random value read from pin A0
110
- u8g2.sendBuffer(); // transfer internal memory to the display
111
- delay(1000);
112
- }
113
-
114
- void BreakoutBoard::setValue_float(float b){
115
-
116
- u8g2.clearBuffer(); // clear the internal memory
117
- u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
118
- u8g2.drawStr(0,10,"Analog Value:"); // write something to the internal memory
119
- u8g2.print(b); // print random value read from pin A0
120
- u8g2.sendBuffer(); // transfer internal memory to the display
121
- delay(1000);
122
- }
123
-
124
- void BreakoutBoard::setValue_char(char c){
125
-
126
- u8g2.clearBuffer(); // clear the internal memory
127
- u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
128
- u8g2.drawStr(0,10,"Analog Value:"); // write something to the internal memory
129
- u8g2.print(c); // print random value read from pin A0
130
- u8g2.sendBuffer(); // transfer internal memory to the display
131
- delay(1000);
132
-
133
- }
134
-
135
- void BreakoutBoard::setValue_char(char c){
136
-
137
- u8g2.clearBuffer(); // clear the internal memory
138
- u8g2.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
139
- u8g2.drawStr(0,10,"Analog Value:"); // write something to the internal memory
140
- u8g2.print(c); // print random value read from pin A0
141
- u8g2.sendBuffer(); // transfer internal memory to the display
142
- delay(1000);
143
-
144
- }
145
- */
30
+ }
0 commit comments