aymen ammari
aymen ammari
DIIDevHeads IoT Integration Server
Created by aymen ammari on 6/12/2024 in #middleware-and-os
making a smoke sensor that sends a sms message to a user when it detects smoke.
I'm new to arduino coding and we are tasked with making a smoke sensor that sends a sms message to a user when it detects smoke. One problem that we've encountered is that our gsm module 900a can't seem to find a network (the status LED blinks every second rather than every 3 seconds). How can we fix this problem? I will provide the code below int buzzer = 8; int smokeA0 = A5; int sensorThres = 0; #include<SoftwareSerial.h> SoftwareSerial GSM (9, 10); void setup() { pinMode(buzzer, OUTPUT); pinMode(smokeA0, INPUT); Serial.begin(9600); GSM.begin (9600); delay(100); } void loop() { int analogSensor = analogRead(smokeA0);
if (analogSensor > sensorThres) { digitalWrite(buzzer, HIGH); delay (1000); Serial.println("AT+CMGF=1");
delay(1000);
Serial.println("AT+CMGS="+639053188487"\r"); Serial.println("smoke detected alert"); Serial.println((char)26); delay(100); } else { digitalWrite(buzzer,LOW); } delay(50); }
13 replies