Arduino Polska Forum

Pełna wersja: sms.available() modem A6
Aktualnie przeglądasz uproszczoną wersję forum. Kliknij tutaj, by zobaczyć wersję z pełnym formatowaniem.
Witam, mam problem z pobieraniem numeru uzywam przykladu z strony arduino program zatrzymuje sie na fragmencie :


Cytat:Serial.println("SMS Messages Receiver");

Poleceniem AT+CMGR=1 moge odczytac wiadomosc z karty SIM, jednak program nic nie wyswietla
Pokaż kod.
Pokaż schemat/zdjęcie układu.
Zobacz sobie z inną biblioteką: https://github.com/skorokithakis/A6lib .
#include <GSM.h>
#include <AltSoftSerial.h>
#define PINNUMBER ""
AltSoftSerial a6thinker(8, 9);
GSM_SMS sms;
GSM gsmAccess;
char remoteNumber[20];
void setup()
{
Serial.begin(38400);
a6thinker.begin(38400);
delay(20000);
Serial.print("a6thinker gotowy ...");
//a6thinker.print("AT+CMGF=1\r");
//delay(100);
//a6thinker.print("AT+CPMS=\"SM\"\r");
//delay(100);
//a6thinker.print("AT+CMGR=1\r");
//delay(100);
//a6thinker.print("ATE1\r");
//delay(100);
//a6thinker.print("AT+CMGR=1,0\r");
//delay(500);
//Serial.println();
//gsm.print("AT+CNMI=2,1,0,0,0\r");
//delay(100);
Serial.println("SMS Messages Receiver");

// connection state
boolean notConnected = true;

// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected)
{
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
notConnected = false;
else
{
Serial.println("Not connected");
delay(1000);
}
}

Serial.println("GSM initialized");
Serial.println("Waiting for messages");
}

void loop()
{
char c;

// If there are any SMSs available()
if (sms.available())
{
Serial.println("Message received from:");

// Get remote number
sms.remoteNumber(remoteNumber, 20);
Serial.println(remoteNumber);

// This is just an example of message disposal
// Messages starting with # should be discarded
if(sms.peek()=='#')
{
Serial.println("Discarded SMS");
sms.flush();
}

// Read message bytes and print them
while(c=sms.read())
Serial.print©;

Serial.println("\nEND OF MESSAGE");

// delete message from modem memory
sms.flush();
Serial.println("MESSAGE DELETED");
}

delay(1000);

}


witam, kaczkat w tej bibliotece nie ma chyba mozliwosci odczytania numeru chyba, ze sie myle i czegos niedopatrzylem

tak jak pisalem wiadomosc sms na karcie sie znajduje ze statusem "read" ale funkcja sms.available jej nie widzi probowalem juz roznych ustawien bez skutku moze ktos na cos wpadnie, a moze to wina modemu ? program zatrzymuje sie na bloku Serial.print("SMS mesages receiver");
monitor portu juz nie wyswietla kolejnych blokow serial.print()
Nie wiem, wpisałem w google Arduino GSM A6 library i znalazło to. Miałem nadzieję, że przetestujesz i opowiesz jak działa. Ale chyba za trudna, szkoda. Ciekawe do czego przykładzie jest to:
Kod:
           Serial.println(sms.number);
           Serial.println(sms.date);
           Serial.println(sms.message);
Gdyby tylko jakoś dało się to sprawdzić.
dzieki za pomoc, teraz na pewno przetestuje