Skip to content

Commit e9e322a

Browse files
authored
Added Examples
1 parent 4fbc1ac commit e9e322a

File tree

4 files changed

+96
-0
lines changed

4 files changed

+96
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#include "Arduino_SensorKit.h"
2+
3+
SensorKit kit;
4+
5+
void setup() {
6+
// put your setup code here, to run once:
7+
Serial.begin(9600);
8+
while(!Serial);
9+
10+
kit.begin();
11+
}
12+
13+
void loop() {
14+
// put your main code here, to run repeatedly:
15+
// 3 axis
16+
Serial.print("x:");
17+
Serial.print(Accelerometer.readX());
18+
Serial.print(" ");
19+
Serial.print("y:");
20+
Serial.print(Accelerometer.readY());
21+
Serial.print(" ");
22+
Serial.print("z:");
23+
Serial.println(Accelerometer.readZ());
24+
25+
delay(500);
26+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include "Arduino_SensorKit.h"
2+
3+
SensorKit kit;
4+
5+
void setup(){
6+
kit.begin();
7+
}
8+
9+
void loop(){
10+
int random_value = random(0,1023); //read value from A0
11+
12+
Oled.clearBuffer(); // clear the internal memory
13+
Oled.setFont(u8g2_font_ncenB08_tr); // choose a suitable font
14+
Oled.drawStr(0,10,"Analog Value:"); // write something to the internal memory
15+
Oled.print(random_value); // print random value read from pin A0
16+
Oled.sendBuffer(); // transfer internal memory to the display
17+
delay(1000);
18+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include "Arduino_SensorKit.h"
2+
3+
SensorKit kit;
4+
5+
float pressure;
6+
7+
void setup() {
8+
Serial.println(9600);
9+
kit.begin();
10+
}
11+
12+
void loop() {
13+
// Get and print temperatures
14+
Serial.print("Temp: ");
15+
Serial.print(Pressure.getTemperature());
16+
Serial.println("C"); // The unit for Celsius because original arduino don't support speical symbols
17+
18+
// Get and print atmospheric pressure data
19+
Serial.print("Pressure: ");
20+
Serial.print(pressure = Pressure.readPressure());
21+
Serial.println("Pa");
22+
23+
// Get and print altitude data
24+
Serial.print("Altitude: ");
25+
Serial.print(Pressure.calcAltitude(pressure));
26+
Serial.println("m");
27+
28+
Serial.println("\n");//add a line between output of different times.
29+
30+
delay(1000);
31+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#include "Arduino_SensorKit.h"
2+
3+
SensorKit kit;
4+
5+
#define DHT_PIN 7
6+
7+
void setup() {
8+
Serial.begin(9600);
9+
kit.begin();
10+
}
11+
12+
void loop() {
13+
14+
Serial.print("Temperature = ");
15+
Serial.print(Environment.readTemperature()); //print temperature
16+
Serial.println(" C");
17+
Serial.print("Humidity = ");
18+
Serial.print(Environment.readHumidity()); //print humidity
19+
Serial.println(" %");
20+
delay(2000);
21+
}

0 commit comments

Comments
 (0)