Hello my friends
sorry for my bad endgish.
I am from Grecce and i am new to Arduino world.
I want to call arduino (sim800l) and arduino answers via SMS.
here is the code i have made so far.
#include <SoftwareSerial.h>
#include <Adafruit_Sensor.h>
#include <DHT.h>
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
#define SIM800_TX_PIN 8
#define SIM800_RX_PIN 7
float h = dht.readHumidity();
float t = dht.readTemperature();
SoftwareSerial serialSIM800(SIM800_TX_PIN,SIM800_RX_PIN);
int incomingByte;
void setup() {
Serial.begin(9600);
while(!Serial);
dht.begin();
serialSIM800.begin(9600);
delay(1000);
float h = dht.readHumidity();
float t = dht.readTemperature();
Serial.print("Humidity: ");
Serial.print(h);
Serial.print(" %");
Serial.print("Temperature: ");
Serial.print(t);
Serial.println(" *C");
Serial.println("Setup Complete!");
delay(1000);
}
void loop() {
if(serialSIM800.available()){
Serial.write(serialSIM800.read());
delay(5000);
}{
if (Serial.available()>0)
incomingByte = Serial.read();
if (incomingByte == 'RING');
{
Serial.println("Start SMS sequense...");
serialSIM800.write("AT+CMGF=1\r\n");
delay(1000);
serialSIM800.write("AT+CMGS=\"+306985123172\"\r\n");
delay(100);
serialSIM800.print("Humidity: ");
serialSIM800.print(h);
serialSIM800.print(" %");
serialSIM800.println();
serialSIM800.print("Temperature: ");
serialSIM800.print(t);
serialSIM800.print(" C");
serialSIM800.println();
serialSIM800.print("Weight: ");
delay(1000);
serialSIM800.write((char)26);
delay(1000);
Serial.println("SMS Sent!");
}
}}
i dont were is the problem.
thans for your time
![]()