File tree Expand file tree Collapse file tree 4 files changed +96
-0
lines changed Expand file tree Collapse file tree 4 files changed +96
-0
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments