Skip to content

1.0.5 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 28 additions & 64 deletions docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,15 @@ The Arduino_SensorKit Library can be downloaded from the Arduino IDE’s library

# Classes

## SensorKit class

### Declaration
## Including the library

```cpp
#include "Arduino_SensorKit.h"

SensorKit kit; //Declare the object to use it later

void setup(){}
void loop(){}
```

### Initialization

Using the function `begin()` at the beginning of the `setup()`

```cpp
#include "Arduino_SensorKit.h"

SensorKit kit; //Declare the object to use it later

void setup(){
kit.begin();
}

void loop(){}
```

## OLED
Using the Grove - OLED Display 0.96 inch

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

```cpp
if(!Oled.begin()){
Serial.println("Error");
while(1);
}
Serial.println("Ok");
void setup(){
Oled.begin();
}
void loop(){}
```
### Printing "hello world"

```cpp
#include "Arduino_SensorKit.h"

SensorKit kit;

void setup() {
kit.begin();
Oled.begin();
Oled.setFlipMode(1); //Rotate it
}

void loop() {
Oled.clearBuffer(); // clear the internal memory
Oled.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
Oled.setCursor(0, 10);
Oled.print("Hello World"); // write something to the internal memory
Oled.sendBuffer(); // transfer internal memory to the display
Oled.setFont(u8x8_font_chroma48medium8_r);
Oled.drawString(0,0,"Hello World!");
Oled.refreshDisplay(); // only required for SSD1606/7
delay(1000);
}
```

### Printing values

```cpp
Oled.print(value);
Oled.print(value);
```

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

```cpp
if (!Accelerometer.begin()){
Serial.println("Error"); // Accelerometer didnt initialized
while(1); // Stop the program
void setup(){
Accelerometer.begin();
}
Serial.println("Init complete");
void loop(){}
```

### Reading the Acceleration X

```cpp
#include "Arduino_SensorKit.h"

SensorKit kit; //Declare the object to use it later


float acceleration;

void setup(){
kit.begin();
Accelerometer.begin();
}

void loop(){
Expand All @@ -119,13 +92,12 @@ Init and returns true if success, already done in the `SensorKit`'s object `begi

```cpp
#include "Arduino_SensorKit.h"
SensorKit kit;

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

setup(){
Serial.begin(9600);
kit.begin();
Accelerometer.begin();
}

loop{
Expand All @@ -145,13 +117,12 @@ Return if the sensor its good to give the data

```cpp
#include "Arduino_SensorKit.h"
SensorKit kit;

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

setup(){
Serial.begin(9600);
kit.begin();
Accelerometer.begin();
}

loop{
Expand All @@ -169,24 +140,22 @@ The Pressure sensor can get temperature, pressure and altitude
### Initialising the sensor
Init and returns true if success, already done in the `SensorKit`'s object `begin()`
```cpp
if (!Pressure.begin()){
Serial.println("Error"); // Accelerometer didnt initialized
while(1); // Stop the program
void setup(){
Pressure.begin();
}
Serial.println("Init complete");
void loop(){}
```

### Reading the Temperature values

```cpp
#include "Arduino_SensorKit.h"
SensorKit kit;

float temperature; // Value for the reading

setup(){
Serial.begin(9600);
kit.begin();
Pressure.begin();
}

loop{
Expand All @@ -200,13 +169,12 @@ Init and returns true if success, already done in the `SensorKit`'s object `begi

```cpp
#include "Arduino_SensorKit.h"
SensorKit kit;

uint32_t pressure; // Value for the reading

setup(){
Serial.begin(9600);
kit.begin();
Pressure.begin();
}

loop{
Expand All @@ -219,13 +187,12 @@ Init and returns true if success, already done in the `SensorKit`'s object `begi
### Reading the Altitude values
```cpp
#include "Arduino_SensorKit.h"
SensorKit kit;

float altitude; // Value for the reading

setup(){
Serial.begin(9600);
kit.begin();
Presure.begin();
}

loop{
Expand All @@ -247,24 +214,22 @@ By default, once you include the library it has been set to digital pin `3`, it

### Initialising the sensor
```cpp
if (!Environment.begin()){
Serial.println("Error"); // Accelerometer didnt initialized
while(1); // Stop the program
void setup(){
Environment.begin();
}
Serial.println("Init complete");
void loop(){}
```

### Reading the Temperature values

```cpp
#include "Arduino_SensorKit.h"
SensorKit kit;

float temperature;

void setup() {
Serial.begin(9600);
kit.begin();
Environment.begin();
}

void loop() {
Expand All @@ -279,7 +244,6 @@ By default, once you include the library it has been set to digital pin `3`, it

```cpp
#include "Arduino_SensorKit.h"
SensorKit kit;

float humidity;

Expand Down
1 change: 1 addition & 0 deletions examples/Oled_Display/Oled_Display.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

void setup() {
Oled.begin();
Oled.setFlipMode(true);
}

void loop() {
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Arduino_Sensorkit
version=1.0.4
version=1.0.5
author=Lenard George, Pablo Marquínez
maintainer=Arduino <info@arduino.cc>
sentence=Arduino Sensor Kit
Expand Down
4 changes: 2 additions & 2 deletions src/Arduino_SensorKit.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "Arduino_Sensorkit.h"
#include "Arduino_SensorKit.h"

//Declare component's classes
U8X8_SSD1306_128X64_NONAME_HW_I2C Oled(U8X8_PIN_NONE);
U8X8_SSD1306_128X64_NONAME_SW_I2C Oled(/* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);
DHT Environment(DHTPIN, DHTTYPE);
SensorKit_LIS3DHTR Accelerometer;
SensorKit_BMP280 Pressure;
2 changes: 1 addition & 1 deletion src/Arduino_SensorKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#endif

//Make the declared components from the .cpp to the sketch available
extern U8X8_SSD1306_128X64_NONAME_HW_I2C Oled;
extern U8X8_SSD1306_128X64_NONAME_SW_I2C Oled;
extern SensorKit_LIS3DHTR Accelerometer;
extern SensorKit_BMP280 Pressure;
extern DHT Environment;
Expand Down