// libraries
#include <GSM.h>
// PIN Number
//#define PINNUMBER ""
// initialize the library instance
GSM gsmAccess; // include a 'true' parameter for debug enabled
GSM_SMS sms;
char remoteNumber[20]; // Holds the emitting number
void setup()
{
// initialize serial communications
Serial.begin(9600);
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()==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(c);
Serial.println("\nEND OF MESSAGE");
// delete message from modem memory
sms.flush();
Serial.println("MESSAGE DELETED");
}
delay(1000);
}
오류를 SMS를 읽는 방법 : GSM_SMS는 이름 유형 .... 은 그래서이 실제로 어떤 오류 이해하지 않는다 ...... PLZ 나에게 적절한 대답을 제공합니다. 정확하게, 나는 Arduino Gboard를 사용하여 SMS를 읽고 모바일을 통해 켜거나 끌고 싶습니다.는 아두 이노 Gboard에서
정확한 오류 메시지를 게시 할 수 있습니까? "GSM_SMS는 이름 유형이 아닙니다"는 의미가 없습니다. 어쩌면 당신의 오류는 ""GSM_SMS는 "유형을 지정하지 않습니다"라고 말하면 아마도 비슷한 오류가있는이 링크가 힌트를 줄 수 있습니다 : https://github.com/groundLAB/GSM-ARDUINO/issues/2 –