-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMajorProjectArduinoCode.ino
49 lines (36 loc) · 1.28 KB
/
MajorProjectArduinoCode.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
//EECS1021 Major Project Code
// Indoor Vs Outdoor Weather Monitoring System
#include "DHT.h"
#include <Arduino.h>
#include "Seeed_BMP280.h"
#include <Wire.h>
BMP280 bmp280;// Pressure Sensor on the Grove Board
#define DHTPIN 3 // what pin we're connected to
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
void setup(void) {
Serial.begin(9600);
bmp280.init();
dht.begin();
}
void loop(void) {
double temp;
double humi;
double pressure;
double altitude;
// Reading the values from DHT11 sensor
temp = dht.readTemperature();
humi = dht.readHumidity();
// Reading the values from BMP280
pressure = bmp280.getPressure();
altitude = bmp280.calcAltitude(pressure);
String sendTemperature = String(temp,2);//Converting double Temperature Data to String
String sendHumidity = String(humi,2);// Converting double Humidity Data to String
String sendPressure = String(pressure,2);// Converting double Pressure data to String
String sendAltitude = String(altitude,2);// Converting double Altitude data to String
// Combining the Temperature and Humidity String
sendTemperature.concat(sendHumidity);
sendTemperature.concat(sendPressure);
sendTemperature.concat(sendAltitude);
Serial.println(sendTemperature);// Sending Combined Data
}