Skip to content

V1.0.4 #1

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 10, 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
4 changes: 1 addition & 3 deletions examples/Accelerometer/Accelerometer.ino
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
#include "Arduino_SensorKit.h"

SensorKit kit;

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
while(!Serial);

kit.begin();
Accelerometer.begin();
}

void loop() {
Expand Down
16 changes: 7 additions & 9 deletions examples/Oled_Display/Oled_Display.ino
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
#include "Arduino_SensorKit.h"

SensorKit kit;

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

void loop() {
int random_value = random(0, 1023); //read value from A0

Oled.clearBuffer(); // clear the internal memory
Oled.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
Oled.setCursor(0, 10);
Oled.print("Analog Value:"); // write something to the internal memory
Oled.print(random_value); // print random value read from pin A0
Oled.sendBuffer(); // transfer internal memory to the display
Oled.setFont(u8x8_font_chroma48medium8_r);
Oled.setCursor(0, 33);
Oled.print("Temp: ");
Oled.print(random_value);
Oled.print("C");
Oled.refreshDisplay();
delay(1000);
}
4 changes: 0 additions & 4 deletions examples/Plug_Sketch_Play/Plug_Sketch_Play.ino
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#include "Arduino_SensorKit.h"

SensorKit kit;

int button = 4;
int LED = 6;

Expand All @@ -10,8 +8,6 @@ void setup() {
Serial.begin(9600);
while (!Serial);

kit.begin();

pinMode(button , INPUT);
pinMode(LED, OUTPUT);

Expand Down
4 changes: 1 addition & 3 deletions examples/Pressure_Sensor/Pressure_Sensor.ino
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#include "Arduino_SensorKit.h"

SensorKit kit;

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

void loop() {
Expand Down
4 changes: 1 addition & 3 deletions examples/Temp_and_Humidity/Temp_and_Humidity.ino
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
//#define DHTPIN 3 // By default its connected to pin D3, it can be changed, define it before the #include of the library
#include "Arduino_SensorKit.h"

SensorKit kit;

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

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.2
version=1.0.3
author=Lenard George, Pablo Marquínez
maintainer=Arduino <info@arduino.cc>
sentence=Arduino Sensor Kit
Expand Down
20 changes: 1 addition & 19 deletions src/Arduino_SensorKit.cpp
Original file line number Diff line number Diff line change
@@ -1,25 +1,7 @@
#include "Arduino_Sensorkit.h"

//Declare component's classes
U8G2_SSD1306_128X64_NONAME_F_SW_I2C Oled(U8G2_R0, SCL, SDA, U8X8_PIN_NONE);
U8X8_SSD1306_128X64_NONAME_HW_I2C Oled(U8X8_PIN_NONE);
DHT Environment(DHTPIN, DHTTYPE);
SensorKit_LIS3DHTR Accelerometer;
SensorKit_BMP280 Pressure;

SensorKit::SensorKit(){}

bool SensorKit::begin(){
Oled.begin();
Oled.enableUTF8Print();

Accelerometer.begin();
delay(100);
Accelerometer.setOutputDataRate(LIS3DHTR_DATARATE_50HZ);

Pressure.begin();
Environment.begin();
}

void SensorKit::end(){

}
12 changes: 2 additions & 10 deletions src/Arduino_SensorKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
#include "Arduino_SensorKit_BMP280.h" // Pressure
#include "Arduino_SensorKit_LIS3DHTR.h" // Accel
#include "DHT.h" // Temp & Humidity
#include "U8g2lib.h" // Oled Display

#include "U8x8lib.h" // Oled Display

//Defines
#ifndef DHTTYPE
Expand All @@ -25,15 +24,8 @@
#define DHTPIN 3
#endif

class SensorKit {
public:
SensorKit();
bool begin();
void end();
};

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