single line output
[Arduino] / wlan_si / wlan_si.ino
1 #include <Wire.h>
2 #include <Adafruit_MPL115A2.h>
3
4 Adafruit_MPL115A2 mpl115a2;
5
6 int led = 5; // LED on d5
7
8 // hardware based on https://dev.wlan-si.net/wiki/Telemetry/sensgw
9 // original software https://github.com/SloMusti/sensgw
10
11 void setup(void) 
12 {
13   Serial.begin(9600);
14   Serial.println("Hello!");
15   
16   Serial.println("Getting barometric pressure ...");
17   mpl115a2.begin();
18   
19   pinMode(led, OUTPUT);
20 }
21
22 void loop(void) 
23 {
24   digitalWrite(led, HIGH);
25
26   float pressureKPA = 0, temperatureC = 0;    
27
28   mpl115a2.getPT(&pressureKPA,&temperatureC);
29   Serial.print("Pressure="); Serial.print(pressureKPA, 4); Serial.print(" kPa ");
30   Serial.print("Temp="); Serial.print(temperatureC, 1); Serial.println(" C");
31
32 /*  
33   pressureKPA = mpl115a2.getPressure();  
34   Serial.print("Pressure (kPa): "); Serial.print(pressureKPA, 4); Serial.println(" kPa");
35
36   temperatureC = mpl115a2.getTemperature();  
37   Serial.print("Temp (*C): "); Serial.print(temperatureC, 1); Serial.println(" *C");
38 */
39
40   digitalWrite(led, LOW);
41   
42   delay(1000);
43 }