有人可以帮我吗?
我在将数据从SIM800C发送到网站时遇到了问题。
第一个问题是,我将以下代码上传到Arduino(我使用Arduino IDE中的串行监视器向SIM800发送AT命令并读取响应)。
#include <SoftwareSerial.h>
#define TX 10
#define RX 11
#define t 2000
SoftwareSerial mySerial(RX, TX);
int k=0, aS=0, amS=0;
void setup() {
Serial.begin(9600);
while(!Serial); // Wait for Serial ready
Serial.println("Intalizing...");
mySerial.begin(9600);
delay(5000);
mySerial.println("AT"); // Send the first AT command to auto set baud rate
delay(1000);
Serial.println("You can type AT command and send to SIM800 by using Serial Monitor");
}
void loop() {
k=0;
aS=Serial.available(); // aS: The number of bytes available to read from the buff of Serial
amS=mySerial.available(); // amS: The number of bytes available to read from the buff of mySerial
while(aS>0) {
mySerial.write(Serial.read());
k=1; aS--;
}
if (k==1) {
mySerial.println();
}
while (amS>0) {
Serial.write(mySerial.read());
k=2; amS--;
}
delay(1000);
}
接下来,我将逐一发送以下 AT 命令并查看响应。所有 AT 命令和响应都可以在串口监视器上看到。
AT+SAPBR=3,1,"Contype","GPRS"
AT+SAPBR=3,1,"APN","m3-world"
AT+SAPBR=3,1,"USER","mms"
AT+SAPBR=3,1,"PWD","mms"
AT+CSTT="m3-world","mms","mms"
AT+SAPBR=1,1
AT+HTTPINIT
AT+HTTPPARA="CID",1
AT+HTTPPARA="URL","http://weatherstation.byethost3.com/"
AT+HTTPDATA=9,10000
value=YOU
AT+HTTPACTION=1
最后的回复显示数据(value=YOU)已经成功发送。
OK
++HTTPACTION:1,200,839
我创建了一个网站以使用GET方法读取数据。 我的问题是网站上没有任何变化。这意味着该网站尚未从SIM800发送的数据中读取到内容。