• Witaj na Forum Arduino Polska! Zapraszamy do rejestracji!
  • Znajdziesz tutaj wiele informacji na temat hardware / software.
Witaj! Logowanie Rejestracja


Ocena wątku:
  • 0 głosów - średnia: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Alarm powiadomienie sms aktywacja sms
#21
Działa musiałem przełączyć na modemie Smile A z tą aktywacją ciężko to zrobić sms ?Smilewtedy było by dokładnie tak jak sobie wymarzyłem
 
Odpowiedź
#22
Jutro coś poczarujemy nockę mam
Ważne aby robić co się lubi albo lubić co się robi .
Arduino UNO, TINY, PRO MINI
Pomoc nagradzamy punktami reputacji Wink
 
Odpowiedź
#23
Super Smile
 
Odpowiedź
#24
zerknij na to . Jak wyślesz 1 powinien włączyć się stan wysoki na pinie 4 czyli 5V jak wyślesz sms 0 to nie będzie napięcia .

Kod:
#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8);
int sms = 0 ;
char incoming_char = 0;

void setup()
{
  SIM900.begin(19200);
  SIM900power();  
  delay(20000);  
  pinMode(2, INPUT_PULLUP);
  pinMode(3, INPUT_PULLUP);
}

void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
  digitalWrite(9, HIGH);
  delay(1000);
  digitalWrite(9, LOW);
  delay(5000);
}

void loop()
{
  if ( digitalRead(2) == LOW ){sms = 1;sendSMS();}
  if ( digitalRead(3) == LOW ){sms = 2;sendSMS();}
  
  if(SIM900.available() >0){
  incoming_char=SIM900.read();
  Serial.print(incoming_char);

if ( incoming_char == '1' ){digitalWrite(4, HIGH);}
if ( incoming_char == '0' ){digitalWrite(4, LOW);}
  
  }
}

void sendSMS()
{
  SIM900.print("AT+CMGF=1\r");                                                        // AT command to send SMS message
  delay(100);
  SIM900.println("AT + CMGS = \"+12128675309\"");                                     // recipient's mobile number, in international format
  delay(100);
if (sms == 1)SIM900.println("sms czujnika 1");        // message to send
if (sms == 2)SIM900.println("sms czujnika 1");
  delay(100);
  SIM900.println((char)26);                       // End AT command with a ^Z, ASCII code 26
  delay(100);
  SIM900.println();
  delay(5000);                                     // give module time to send SMS
  SIM900power();
  sms = 0;  // turn off module
}
Ważne aby robić co się lubi albo lubić co się robi .
Arduino UNO, TINY, PRO MINI
Pomoc nagradzamy punktami reputacji Wink
 
Odpowiedź
#25
Nie działa a pin 4 jest od sygnału od czujnika tak ma być że tam wyłączy
 
Odpowiedź
#26
Nie chce wyłączyć
 
Odpowiedź
#27
zerknij na to ... uruchom czujnik niech wyśle ci sms-a poczekaj 5 sekund a później wyślij sms z cyferką 1 poczekaj 5 sekund i wyślij cyferkę 0 powinno na porcie 4 pojawić się i zniknąć napięcie a czujniki masz pod 2 i 3

Kod:
#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8);
int sms = 0 ;
char incoming_char = 0;

void setup()
{
  SIM900.begin(19200);
  SIM900power();  
  delay(20000);  
  pinMode(2 , INPUT_PULLUP);
  pinMode(3 , INPUT_PULLUP);
  pinMode(4 , OUTPUT);
  digitalWrite(4, LOW);
  
  SIM900.print("AT+CMGF=1\r");                                                        // AT command to send SMS message
  delay(100);
  
}

void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
  digitalWrite(9, HIGH);
  delay(1000);
  digitalWrite(9, LOW);
  delay(5000);
}

void loop()
{
  if ( digitalRead(2) == LOW ){sms = 1;sendSMS();}
  if ( digitalRead(3) == LOW ){sms = 2;sendSMS();}
  if(SIM900.available() >0){receiveSMS();}
    
}

void sendSMS(){
  
  SIM900.println("AT + CMGS = \"+12128675309\"");                                     // recipient's mobile number, in international format
  delay(100);
  if (sms == 1)SIM900.println("sms czujnika 1");        // message to send
  if (sms == 2)SIM900.println("sms czujnika 1");
  delay(100);
  SIM900.println((char)26);                       // End AT command with a ^Z, ASCII code 26
  delay(100);
  SIM900.println();
  delay(5000);                                     // give module time to send SMS
  sms = 0;  
  SIM900.print("AT+CNMI=2,2,0,0,0\r");
  delay(200);
  SIM900.println("AT+CMGD=1,4");
  delay(200);
}

void receiveSMS(){

  incoming_char=SIM900.read();
  delay(20);
  if ( incoming_char == '1' ){digitalWrite(4, HIGH);}
  if ( incoming_char == '0' ){digitalWrite(4, LOW);}
  Serial.print(incoming_char);
  SIM900.println("AT+CMGD=1,4");
  
}
Ważne aby robić co się lubi albo lubić co się robi .
Arduino UNO, TINY, PRO MINI
Pomoc nagradzamy punktami reputacji Wink
 
Odpowiedź
#28
Jednego sms wysyła i koniec . Ogólnie coś ie tak raz wyśle raz nie przy resecie
 
Odpowiedź
#29
Wiem że ciężko napisać zwłaszcza bez sim900 :/
 
Odpowiedź
#30
Zerknij tu miedzy komendami musi upłynąć około 10 sekund

Kod:
#include <SoftwareSerial.h>
SoftwareSerial SIM900(7, 8);
int sms = 5 ;
char incoming_char = 0;

void setup()
{
  SIM900.begin(19200);
  SIM900power();  
  delay(20000);  
  pinMode(2 , INPUT_PULLUP);
  pinMode(3 , INPUT_PULLUP);
  pinMode(4 , OUTPUT);
  digitalWrite(4, LOW);
  delay(200);
  smsRecStart();
  
}

void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
  digitalWrite(9, HIGH);
  delay(1000);
  digitalWrite(9, LOW);
  delay(5000);
  
}

void loop()
{
  if ( digitalRead(2) == LOW ){sms = 1;sendSMS();}
  if ( digitalRead(3) == LOW ){sms = 2;sendSMS();}
  receiveSMS();
  sms = 0 ;  
}

void sendSMS(){
  
  SIM900.print("AT+CMGF=1\r");                                                        // AT command to send SMS message
  delay(100);
  SIM900.println("AT + CMGS = \"+12128675309\"");                                     // recipient's mobile number, in international format
  delay(100);
  if (sms == 1)SIM900.println("sms czujnika 1");        // message to send
  if (sms == 2)SIM900.println("sms czujnika 1");
  delay(100);
  SIM900.println((char)26);                       // End AT command with a ^Z, ASCII code 26
  delay(100);
  SIM900.println();
  delay(5000);                                     // give module time to send SMS
  smsRecStart();
}

void receiveSMS(){

  if(SIM900.available() >0){
  incoming_char=SIM900.read();
  delay(20);
  if ( incoming_char == '1' ){digitalWrite(4, HIGH);}
  if ( incoming_char == '0' ){digitalWrite(4, LOW);}
  Serial.print(incoming_char);
  SIM900.println("AT+CMGD=1,4");
  }
}

void smsRecStart(){
  
  SIM900.print("AT+CMGF=1\r");                                                        // AT command to send SMS message
  delay(100);
  SIM900.print("AT+CNMI=2,2,0,0,0\r");
  delay(200);
  SIM900.println("AT+CMGD=1,4");
  
}
Ważne aby robić co się lubi albo lubić co się robi .
Arduino UNO, TINY, PRO MINI
Pomoc nagradzamy punktami reputacji Wink
 
Odpowiedź
  


Skocz do:


Przeglądający: 1 gości