Robofun 機器人論壇
標題:
How sending data to Google docs
[打印本頁]
作者:
sfzvzfbv
時間:
2015-6-7 21:36
標題:
How sending data to Google docs
以下是我的程式碼:
#include <SPI.h>
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
char server[] = "docs.google.com";
IPAddress ip = (192, 168, 0, 107);
//IPAddress subnet = (,,,);
//IPAddress gateway = (,,,);
//IPAddress DNS = (,,,);
EthernetClient client;
void setup()
{
Serial.begin(9600);
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
Ethernet.begin(mac, ip);
}
delay(1000);
Serial.println("connecting...");
if (client.connect(server, 80)) {
Serial.println("connected");
client.print("GET /forms/d/1R7-wmVhXuPWXnQ2RKimmwC6OGktYoCydRNPDZr7VpZ0/formResponse?ifq&entry.1757053596=Night&entry.1374568256=30&submit=Submit HTTP/1.1");
client.println("Host: docs.google.com");
client.println("Connection: close");
client.println();
Serial.print("GET /forms/d/1R7-wmVhXuPWXnQ2RKimmwC6OGktYoCydRNPDZr7VpZ0/formResponse?ifq&entry.1757053596=Night&entry.1374568256=30&submit=Submit HTTP/1.1");
Serial.println("Host: docs.google.com");
Serial.println("Connection: close");
Serial.println();
}
}
void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
while (true);
}
}
複製代碼
歡迎光臨 Robofun 機器人論壇 (https://robofun.net/forum/)
Powered by Discuz! X3.2