这个是英文书本,看到联网这块的部分,对网络不是很懂,虽然有英文解释还是有点不懂,希望谁能给我讲解下
#if ARDUINO > 18
#include <SPI.h> // needed for Arduino versions later than 0018
#endif
#include <Ethernet.h>
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168 1, 177 }; // change to a valid address for your network
byte server[] = { 64, 233, 187, 99 }; // Google
// see text for more on IP addressing
Client client(server, 80);
void setup()
{
Ethernet.begin(mac, ip); // start ethernet using the mac and IP address
Serial.begin(9600); // start the serial library:
delay(1000); // give the ethernet hardware a second to initialize
Serial.println("connecting...");
if (client.connect()) {
Serial.println("connected");
client.println("GET /search?q=arduino HTTP/1.0"); // the HTTP request
client.println();
} else {
Serial.println("connection failed");
void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c); // echo all data received to the Serial Monitor
}
if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;;)
;
}
}这些是什么意思?byte ip[] = { 192, 168 1, 177 };这个是写自己的ip地址么,通过路由器获取到ip信息。byte server[] = { 64, 233, 187, 99 }是谷歌的ip地址?红色部分也不是很懂,希望大家不要喷的太凶 |