Arduino atmega16中未接收到GSM Sim300响应
我正在使用Sim300,试图通过串行通信在atmega16上接收sms。 当我从手机向gsm调制解调器发送“*23#”短信时,gsm会发送 \r\n+CMGR:\s“REC\sUNREAD”、“+919762148043”、“14/03/13,23:04:32+22”\r\n*23\r\n\r\nOK\r\n 作为串行端口上的响应。 我在atmega16上获得这些数据,但仅限于 \r\n+CMGR:\s“REC\sUNREAD”、“+919762148043”、“14/03/13,23:04:32+22”\r 这大部分字符串中的“*23#”是我的实际短信,我对“23”很感兴趣。 我的固件看起来像这样Arduino atmega16中未接收到GSM Sim300响应,arduino,Arduino,我正在使用Sim300,试图通过串行通信在atmega16上接收sms。 当我从手机向gsm调制解调器发送“*23#”短信时,gsm会发送 \r\n+CMGR:\s“REC\sUNREAD”、“+919762148043”、“14/03/13,23:04:32+22”\r\n*23\r\n\r\nOK\r\n 作为串行端口上的响应。 我在atmega16上获得这些数据,但仅限于 \r\n+CMGR:\s“REC\sUNREAD”、“+919762148043”、“14/03/13,23:04:3
while(Serial.available())
{
char tempChar = Serial.read();
if(tempChar == '+')
{
isPreSms = true;
lcd.print('+');
}
else if((tempChar == '\r') && (isPreSms == true))
{
isPreSms = false;
lcd.print('r');
}
else if(tempChar == '*')
{
digitalWrite(OKLed, HIGH);
isSms = true;
lcd.print('*');
}
else if((tempChar == '#') && (isSms == true))
{
digitalWrite(powerLed, HIGH);
isSms = false;
lcd.print(sms);
}
else if(isSms)
{
digitalWrite(alertLed, HIGH);
sms += tempChar;
}
}
lcd.print('@');
}
我希望在lcd上输出“+++r*23@”。我已经检查过了,它接收“+”和“\r”,但不接收“*”和更多。我被困在这里,请帮忙,出了什么问题。现在我解决了。
串行缓冲区的大小有问题。我把它的大小增加到128字节,现在可以正常工作了