使用通过GSM与Arduino UNO连接的SIM808模块发布到CloudMQTT服务器时遇到问题
尝试了所有我可以在互联网上找到的示例。但是他们都没有解决我的问题。尝试了FONA库和其他Internet上可用的Arduino代码。
SoftwareSerial mySerial(7,8); // RX, TX
void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
delay(10000);
mySerial.println("AT");
delay(1000);
while(mySerial.available()>0){
Serial.write(mySerial.read());
}
mySerial.println("AT+CSTT=\"www\",\"\",\"\"");
delay(2000);
while(mySerial.available()>0){
Serial.write(mySerial.read());
}
mySerial.println("AT+CIICR");
delay(1000);
while(mySerial.available()>0){
Serial.write(mySerial.read());
}
Serial.flush();
mySerial.flush();
mySerial.println("AT+CIFSR");
delay(1000);
while(mySerial.available()>0){
Serial.write(mySerial.read());
}
mySerial.println("AT+CIPSTART=\"TCP\",\"postman.cloudmqtt.com\",\"16436\"");
delay(5000);
while(mySerial.available()>0){
Serial.write(mySerial.read());
}
while(mySerial.available()>0){
Serial.write(mySerial.read());
}
while(mySerial.available()>0){
Serial.write(mySerial.read());
}
while(mySerial.available()>0){
Serial.write(mySerial.read());
}
mySerial.println("AT+CIPSEND");
delay(5000);
mySerial.print(",MQIsdpÂ<ABCDEFdbtfmzugOfFiESqAb9zg0valetronhelloravi");
delay(2000);
while(mySerial.available()>0){
Serial.write(mySerial.read());
}
}
但是cloudMQTT控制台中没有任何显示