File tree Expand file tree Collapse file tree 3 files changed +28
-17
lines changed Expand file tree Collapse file tree 3 files changed +28
-17
lines changed Original file line number Diff line number Diff line change 1
- # Arduino Sensorkit Library
2
-
3
- ![ ] ( https://travis-ci.org/arduino-libraries/MKRGSM.svg?branch=master )
4
-
5
- This library is for the Arduino Sensor Kit
1
+ # Arduino Sensorkit Library
2
+
3
+ ![ ] ( https://travis-ci.org/arduino-libraries/MKRGSM.svg?branch=master )
4
+
5
+ This library is for the Arduino Sensor Kit
Original file line number Diff line number Diff line change 2
2
3
3
SensorKit kit;
4
4
5
+ float pressure;
6
+
5
7
void setup () {
6
8
Serial.begin (9600 );
7
9
kit.begin ();
@@ -15,7 +17,7 @@ void loop() {
15
17
16
18
// Get and print atmospheric pressure data
17
19
Serial.print (" Pressure: " );
18
- Serial.print (Pressure.readPressure ());
20
+ Serial.print (pressure = Pressure.readPressure ());
19
21
Serial.println (" Pa" );
20
22
21
23
// Get and print altitude data
Original file line number Diff line number Diff line change 2
2
3
3
SensorKit kit;
4
4
5
- float temperature;
5
+ int pressure;
6
+ int accelX;
7
+ int humidity;
6
8
7
9
void setup () {
8
10
// put your setup code here, to run once:
9
11
Serial.begin (9600 );
10
- while (!Serial);
11
- Serial.println (" init" );
12
-
13
12
kit.begin ();
14
- Oled.setFont (u8g2_font_ncenB08_tr); // choose a suitable font
15
13
}
16
14
17
15
void loop () {
18
16
// put your main code here, to run repeatedly:
19
- temperature = Pressure.readTemperature ();
20
- Serial.println (temperature);
17
+ pressure = Pressure.readPressure ();
18
+ accelX = Accelerometer.readX ();
19
+ humidity = Environment.readHumidity ();
20
+
21
+ Serial.print (" Pressure: " );
22
+ Serial.println (pressure);
23
+ Serial.println ();
24
+
25
+ Serial.print (" Accel X: " );
26
+ Serial.println (accelX);
21
27
28
+ Serial.print (" Humidity: " );
29
+ Serial.println (humidity);
30
+
22
31
printScreen ();
32
+ delay (1000 );
23
33
}
24
34
25
35
void printScreen () {
26
36
Oled.clearBuffer (); // clear the internal memory
27
- Oled.setCursor ( 0 , 10 );
28
- Oled.print (temperature); // print random value read from pin A0
29
- Oled.print (" ºC " );
37
+ Oled.setFont (u8g2_font_ncenB08_tr); // choose a suitable font
38
+ Oled.drawStr ( 0 , 10 , " Analog Value: " ); // write something to the internal memory
39
+ Oled.print (pressure); // print random value read from pin A0
30
40
Oled.sendBuffer (); // transfer internal memory to the display
31
- delay (1000 );
32
41
}
You can’t perform that action at this time.
0 commit comments