0
我使用ENC28J60絕對newbee您好,我想一些數據上傳到我的seerver(在php):Arduino的以太網ENC28J60
我拿一個PHP從0fees託管,現在我可以使用數據發送到我的服務器:http://ashutest123.0fees.us/dataupload1.php?data=somedata並檢查上傳的表中的數據列表爲http://ashutest123.0fees.us/showdata.php ---你可以自己查看。
我寫使用UIPEthernet一個Arduino代碼(使用Aruino烏諾和ENC28J60從ebay.in模塊)LIB
#include <UIPEthernet.h> // Used for Ethernet
// **** ETHERNET SETTING ****
// Arduino Uno pins: 10 = CS, 11 = MOSI, 12 = MISO, 13 = SCK
// Ethernet MAC address - must be unique on your network - MAC Reads T4A001 in hex (unique in your network)
byte mac[] = { 0x54, 0x34, 0x41, 0x30, 0x30, 0x31 };
// For the rest we use DHCP (IP address and such)
EthernetClient client;
char server[] = "ashutest123.0fees.us"; // IP Adres (or name) of server to dump data to
int interval = 5000; // Wait between dumps
void setup() {
Serial.begin(9600);
Ethernet.begin(mac);
Serial.println("Tweaking4All.com - Temperature Drone - v2.0");
Serial.println("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
Serial.print("IP Address : ");
Serial.println(Ethernet.localIP());
Serial.print("Subnet Mask : ");
Serial.println(Ethernet.subnetMask());
Serial.print("Default Gateway IP: ");
Serial.println(Ethernet.gatewayIP());
Serial.print("DNS Server IP : ");
Serial.println(Ethernet.dnsServerIP());
}
void loop() {
// if you get a connection, report back via serial:
if (client.connect(server, 80)) {
Serial.println("-> Connected");
// Make a HTTP request:
client.print("GET /dataupload1.php?");
client.print("data=");
client.print("somedata");
client.println(" HTTP/1.1");
client.print("Host: ");
client.println(server)
client.println("Connection: close");
client.println();
client.println();
client.stop();
}
else {
// you didn't get a connection to the server:
Serial.println("--> connection failed/n");
}
delay(interval);
}
當我運行它在串行監控它顯示了所有IP,DNS,網關等地址爲0.0 .0.0 ----似乎沒有DHCP劉寶 然後顯示「連接」
沒有數據去到我的服務器
請幫助我,我在需要它
在此先感謝