-
Notifications
You must be signed in to change notification settings - Fork 0
/
bmponly.ino
32 lines (24 loc) · 909 Bytes
/
bmponly.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "Wire.h" // imports the wire library for talking over I2C
#include "Adafruit_BMP085.h" // import the Pressure Sensor Library
Adafruit_BMP085 mySensor; // create sensor object called mySensor
float tempC; // Variable for holding temp in C
float tempF; // Variable for holding temp in F
float pressure; //Variable for holding pressure reading
void setup(){
Serial.begin(9600); //turn on serial monitor
mySensor.begin(); //initialize mySensor
}
void loop() {
tempC = mySensor.readTemperature(); // Read Temperature
tempF = tempC*1.8 + 32.; // Convert degrees C to F
pressure=mySensor.readPressure(); //Read Pressure
Serial.print("The Temp is: "); //Print Your results
Serial.print(tempF);
Serial.println(" degrees F");
Serial.print(tempC);
Serial.print("The Pressure is: ");
Serial.print(pressure);
Serial.println(" Pa.");
Serial.println("");
delay(250); //Pause between readings.
}