NBH
Newbie
Can someone help me fix this problem I don't understand the issue there is Simulation errors that I got and the schematic
And this is the code that I usedISIS Release 8.15.01 (Build 34318) (C) Labcenter Electronics 1990- 2022.
Netlist compilation completed OK.
Netlist linking completed OK.
Partition analysis completed OK.
Simulating partition [60B325E8]
PROSPICE 8.13.00 (Build 32709) (C) Labcenter Electronics 1993-2022.
Loaded netlist 'C:\Users\nassi\AppData\Local\Temp\LISA2686.SDF' for design 'gsm.pdsprj'
AVR Release 8.3SP0 build 33337 for ATMEGA328P. [ARD1]
Loading HEX file '..\..\..\..\AppData\Local\Temp\arduino\sketches\E45D23BE0D98454B67F2D2DAB5A79D99\gsm_DHT1100.ino.hex'. [ARD1]
Read total of 9082 bytes from file '..\..\..\..\AppData\Local\Temp\arduino\sketches\E45D23BE0D98454B67F2D2DAB5A79D99\gsm_DHT1100.ino.hex'. [ARD1]
AVR Release 8.3SP0 build 33337 for ATMEGA328P. [GSM1]
AVR: Program property is not defined.
Real Time Simulation failed to start.
C++:
#include <SoftwareSerial.h>
#include <DHT.h>
// Define pins and variables
#define DHTPIN 2 // DHT11 data pin connected to digital pin 2
#define DHTTYPE DHT11 // DHT 11 sensor
DHT dht(DHTPIN, DHTTYPE);
// Initialize SIM800L on software serial
SoftwareSerial sim800l(10, 11); // RX, TX (connect to TX and RX of SIM800L)
void setup() {
Serial.begin(9600); // Serial monitor for debugging
sim800l.begin(9600); // SIM800L baud rate
dht.begin();
delay(1000); // Allow time for SIM800L to initialize
// Test SIM800L connection
sim800l.println("AT");
delay(1000);
if (sim800l.available()) {
Serial.println("SIM800L Ready!");
} else {
Serial.println("SIM800L not responding");
}
}
void loop() {
// Read temperature and humidity
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
// Check if data is valid
if (isnan(humidity) || isnan(temperature)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
// Format message
String message = "Temp: " + String(temperature) + "°C, Humidity: " + String(humidity) + "%";
Serial.println("Sending SMS: " + message);
// Send SMS
sendSMS("+1234567890", message); // Replace with recipient phone number
delay(60000); // Send data every 60 seconds
}
// Function to send SMS
void sendSMS(String phoneNumber, String message) {
sim800l.println("AT+CMGF=1"); // Set SMS mode to text
delay(1000);
sim800l.print("AT+CMGS=\"");
sim800l.print(phoneNumber); // Phone number
sim800l.println("\"");
delay(1000);
sim800l.println(message); // SMS content
delay(100);
sim800l.write(26); // ASCII code for CTRL+Z to send
delay(1000);
Serial.println("SMS sent!");
}