Skip to content

Commit ec07186

Browse files
authored
Update readme.md
1 parent 1fe9de2 commit ec07186

File tree

1 file changed

+28
-64
lines changed

1 file changed

+28
-64
lines changed

docs/readme.md

Lines changed: 28 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -10,35 +10,15 @@ The Arduino_SensorKit Library can be downloaded from the Arduino IDE’s library
1010

1111
# Classes
1212

13-
## SensorKit class
14-
15-
### Declaration
13+
## Including the library
1614

1715
```cpp
1816
#include "Arduino_SensorKit.h"
1917

20-
SensorKit kit; //Declare the object to use it later
21-
2218
void setup(){}
2319
void loop(){}
2420
```
2521

26-
### Initialization
27-
28-
Using the function `begin()` at the beginning of the `setup()`
29-
30-
```cpp
31-
#include "Arduino_SensorKit.h"
32-
33-
SensorKit kit; //Declare the object to use it later
34-
35-
void setup(){
36-
kit.begin();
37-
}
38-
39-
void loop(){}
40-
```
41-
4222
## OLED
4323
Using the Grove - OLED Display 0.96 inch
4424

@@ -47,37 +27,33 @@ Using the Grove - OLED Display 0.96 inch
4727
Init and returns true if success, already done in the `SensorKit`'s object `begin()`
4828

4929
```cpp
50-
if(!Oled.begin()){
51-
Serial.println("Error");
52-
while(1);
53-
}
54-
Serial.println("Ok");
30+
void setup(){
31+
Oled.begin();
32+
}
33+
void loop(){}
5534
```
5635
### Printing "hello world"
5736
5837
```cpp
5938
#include "Arduino_SensorKit.h"
6039
61-
SensorKit kit;
62-
6340
void setup() {
64-
kit.begin();
41+
Oled.begin();
42+
Oled.setFlipMode(1); //Rotate it
6543
}
6644
6745
void loop() {
68-
Oled.clearBuffer(); // clear the internal memory
69-
Oled.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
70-
Oled.setCursor(0, 10);
71-
Oled.print("Hello World"); // write something to the internal memory
72-
Oled.sendBuffer(); // transfer internal memory to the display
46+
Oled.setFont(u8x8_font_chroma48medium8_r);
47+
Oled.drawString(0,0,"Hello World!");
48+
Oled.refreshDisplay(); // only required for SSD1606/7
7349
delay(1000);
7450
}
7551
```
7652

7753
### Printing values
7854

7955
```cpp
80-
Oled.print(value);
56+
Oled.print(value);
8157
```
8258

8359
## Accelerometer
@@ -88,24 +64,21 @@ Using the Grove - 3-Axis Digital Accelerometer (±1.5g)
8864
Init and returns true if success, already done in the `SensorKit`'s object `begin()`
8965

9066
```cpp
91-
if (!Accelerometer.begin()){
92-
Serial.println("Error"); // Accelerometer didnt initialized
93-
while(1); // Stop the program
67+
void setup(){
68+
Accelerometer.begin();
9469
}
95-
Serial.println("Init complete");
70+
void loop(){}
9671
```
9772
9873
### Reading the Acceleration X
9974
10075
```cpp
10176
#include "Arduino_SensorKit.h"
102-
103-
SensorKit kit; //Declare the object to use it later
104-
77+
10578
float acceleration;
10679
10780
void setup(){
108-
kit.begin();
81+
Accelerometer.begin();
10982
}
11083
11184
void loop(){
@@ -119,13 +92,12 @@ Init and returns true if success, already done in the `SensorKit`'s object `begi
11992

12093
```cpp
12194
#include "Arduino_SensorKit.h"
122-
SensorKit kit;
12395

12496
float x,y,z; // Values for the readings
12597

12698
setup(){
12799
Serial.begin(9600);
128-
kit.begin();
100+
Accelerometer.begin();
129101
}
130102

131103
loop{
@@ -145,13 +117,12 @@ Return if the sensor its good to give the data
145117
146118
```cpp
147119
#include "Arduino_SensorKit.h"
148-
SensorKit kit;
149120
150121
float x,y,z; // Values for the readings
151122
152123
setup(){
153124
Serial.begin(9600);
154-
kit.begin();
125+
Accelerometer.begin();
155126
}
156127
157128
loop{
@@ -169,24 +140,22 @@ The Pressure sensor can get temperature, pressure and altitude
169140
### Initialising the sensor
170141
Init and returns true if success, already done in the `SensorKit`'s object `begin()`
171142
```cpp
172-
if (!Pressure.begin()){
173-
Serial.println("Error"); // Accelerometer didnt initialized
174-
while(1); // Stop the program
143+
void setup(){
144+
Pressure.begin();
175145
}
176-
Serial.println("Init complete");
146+
void loop(){}
177147
```
178148
179149
### Reading the Temperature values
180150
181151
```cpp
182152
#include "Arduino_SensorKit.h"
183-
SensorKit kit;
184153
185154
float temperature; // Value for the reading
186155
187156
setup(){
188157
Serial.begin(9600);
189-
kit.begin();
158+
Pressure.begin();
190159
}
191160
192161
loop{
@@ -200,13 +169,12 @@ Init and returns true if success, already done in the `SensorKit`'s object `begi
200169

201170
```cpp
202171
#include "Arduino_SensorKit.h"
203-
SensorKit kit;
204172

205173
uint32_t pressure; // Value for the reading
206174

207175
setup(){
208176
Serial.begin(9600);
209-
kit.begin();
177+
Pressure.begin();
210178
}
211179

212180
loop{
@@ -219,13 +187,12 @@ Init and returns true if success, already done in the `SensorKit`'s object `begi
219187
### Reading the Altitude values
220188
```cpp
221189
#include "Arduino_SensorKit.h"
222-
SensorKit kit;
223190
224191
float altitude; // Value for the reading
225192
226193
setup(){
227194
Serial.begin(9600);
228-
kit.begin();
195+
Presure.begin();
229196
}
230197
231198
loop{
@@ -247,24 +214,22 @@ By default, once you include the library it has been set to digital pin `3`, it
247214
248215
### Initialising the sensor
249216
```cpp
250-
if (!Environment.begin()){
251-
Serial.println("Error"); // Accelerometer didnt initialized
252-
while(1); // Stop the program
217+
void setup(){
218+
Environment.begin();
253219
}
254-
Serial.println("Init complete");
220+
void loop(){}
255221
```
256222

257223
### Reading the Temperature values
258224

259225
```cpp
260226
#include "Arduino_SensorKit.h"
261-
SensorKit kit;
262227

263228
float temperature;
264229

265230
void setup() {
266231
Serial.begin(9600);
267-
kit.begin();
232+
Environment.begin();
268233
}
269234

270235
void loop() {
@@ -279,7 +244,6 @@ By default, once you include the library it has been set to digital pin `3`, it
279244
280245
```cpp
281246
#include "Arduino_SensorKit.h"
282-
SensorKit kit;
283247
284248
float humidity;
285249

0 commit comments

Comments
 (0)