Hi guys, i am having this kind of problem since i am very new to arduino. i have this project called Weather Monitoring System which basically detects the environmental condition using the sensors DHT11 and BMP180. what i want now is to receive a message which contains the data gathered from the sensors from the SIM800L GSM module and then to my Cell phone so i will know the condition of the weather. Here is my progress/code:
#include <Sim800l.h>
#include <SoftwareSerial.h>
#include <dht.h>
#include <Wire.h>
#include <SFE_BMP180.h>
#define SIM800_TX_PIN 11
#define SIM800_RX_PIN 10
#define DHT11_PIN 7
#define ALTITUDE 35 //Altitude where I live (change this to your altitude)
SFE_BMP180 pressure; //Creating an object
dht DHT;
SoftwareSerial serialSIM800(11,10);
void setup() {
Serial.begin(9600); //Starting serial communication
while(!Serial);
serialSIM800.begin(9600);
delay(1000);
Serial.println("Setup Complete!");
Serial.println("Sending SMS....");
serialSIM800.write("AT+CMGF=1\r\n");
delay(1000);
serialSIM800.write("AT+CMGS=09359652262");
delay(1000);
serialSIM800.write("TEST");
delay(1000);
Serial.println("ZEUS");
if (pressure.begin()) //If initialization was successful, continue
Serial.println(" ");
else //Else, stop code forever
{
Serial.println("BMP180 init fail");
while (1);
}
}
void loop() {
int chk = DHT.read11(DHT11_PIN);
char status;
double T, P, p0; //Creating variables for temp, pressure and relative pressure
Serial.print("Humidity= ");
Serial.println(DHT.humidity);
Serial.print("Temperature=");
Serial.println(DHT.temperature);
status = pressure.startTemperature();
if (status != 0) {
delay(status);
status = pressure.getTemperature(T);
if (status != 0) {
Serial.print("Temp: ");
Serial.print(T, 1);
Serial.println(" deg C");
status = pressure.startPressure(3);
if (status != 0) {
delay(status);
status = pressure.getPressure(P, T);
if (status != 0) {
Serial.print("Pressure measurement: ");
Serial.print(P);
Serial.println(" hPa ");
p0 = pressure.sealevel(P, ALTITUDE);
Serial.print("Relative pressure: ");
Serial.print(p0);
Serial.println("hPa");
}
}
}
}
delay(2000);
}