我之前通过AT命令用Pmod ESP32向Thingspeak传输数据,但不知道Firebase可不可以做得到?
如果可以,我应该用什么样的URL?
以下是我写的程序
```void setWifiMode(void){
u8 tx[]="AT+CWMODE=3\r\n";
u32 num = strlen((char *) tx);
xil_printf((char *) tx);
ESP32_SendBuffer(&ESP32, tx, num);
usleep(100);
receiveData(3);
}
void connectWifi(void){
u8 tx[] = "AT+CWJAP=\"<ssid>\",\"<密码>\"\r\n";
u32 num = strlen((char *) tx);
xil_printf((char *) tx);
ESP32_SendBuffer(&ESP32, tx, num);
usleep(100);
receiveData(30);
}
void establishConnection(void){
u8 tx[] = "AT+CIPSTART=\"TCP\",\"api.thingspeak.com\",80\r\n";
u32 num = strlen((char *) tx);
xil_printf((char *) tx);
ESP32_SendBuffer(&ESP32, tx, num);
receiveData(2);
}
void cipsend(float temp, u16 co2, u8 light, float humidity,float ec,float ph){
u8 command[150];
u8 finalcmd[50];
//field1 Ph field2 Temp field3 co2 field4 humidity field5 light
//CE8VFL1E8ZJNGZM8
//DM4ANODDROIY3TCE (Andy Acc)
sprintf((char*)command, "GET http://api.thingspeak.com/update?api_key=xxxxxxxxxx&field1=%d.%02d&field2=%d.%02d&field3=%d&field4=%d.%02d&field5=%d&field6=%d.%02d\r\n"
,(int) ph,((int) (ph * 100)) % 100,(int) temp_degc,((int) (temp_degc * 100)) % 100,co2,(int) hum_perrh,((int) (hum_perrh * 100)) % 100,light,(int) ec,((int) (ec * 100)) % 100);
u32 length = strlen((char*)command);
sprintf((char*)finalcmd, "AT+CIPSEND=%d\r\n", (int)length);
u32 cmdlength =strlen((char*)finalcmd);
//xil_printf("Length %d\r\n", length);
//xil_printf((char *)finalcmd);
ESP32_SendBuffer(&ESP32, finalcmd, cmdlength);
sleep(1);
//xil_printf((char *)command);
ESP32_SendBuffer(&ESP32, command, length);
receiveData(4);
}
```
你好,我是有问必答小助手,非常抱歉,本次您提出的有问必答问题,技术专家团超时未为您做出解答
本次提问扣除的有问必答次数,将会以问答VIP体验卡(1次有问必答机会、商城购买实体图书享受95折优惠)的形式为您补发到账户。
因为有问必答VIP体验卡有效期仅有1天,您在需要使用的时候【私信】联系我,我会为您补发。