-
Notifications
You must be signed in to change notification settings - Fork 0
/
WorkingSERLCDmodeWTempPress.ino
85 lines (64 loc) · 2.16 KB
/
WorkingSERLCDmodeWTempPress.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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
Reading barometric pressure from the MS8607
By: PaulZC
Date: January 28th, 2020
Based extensively on:
Reading barometric pressure from the MS5637
By: Nathan Seidle
SparkFun Electronics
License: MIT. See license file for more information but you can
basically do whatever you want with this code.
The original library and example code was written by TEConnectivity,
the company that made the sensor. Way to go TE! May other companies
learn from you.
Feel like supporting open source hardware?
Buy a board from SparkFun!
This example prints the current pressure in hPa and temperature in C.
*/
#include <Wire.h>
#include <SerLCD.h>
#include <SparkFun_PHT_MS8607_Arduino_Library.h> // Click here to get the library: http://librarymanager/All#SparkFun_PHT_MS8607
MS8607 barometricSensor;
SerLCD lcd;
void setup(void)
{
Serial.begin(115200);
Serial.println("Qwiic PHT Sensor MS8607 Example");
Wire.begin();
lcd.begin(Wire); //Set up the LCD for I2C communication
lcd.setBacklight(255, 255, 255); //Set backlight to bright white
lcd.setContrast(5); //Set contrast. Lower to 0 for higher contrast.
lcd.clear(); //Clear the display - this moves the cursor to home position as well
lcd.print("Hello, World!");
if (barometricSensor.begin() == false)
{
Serial.println("MS8607 sensor did not respond. Trying again...");
if (barometricSensor.begin() == false)
{
Serial.println("MS8607 sensor did not respond. Please check wiring.");
while (1)
;
}
}
}
void loop(void)
{
float temperature = barometricSensor.getTemperature();
float pressure = barometricSensor.getPressure();
Serial.print("Temperature=");
Serial.print(temperature, 1);
<