“Ethernet库”的版本间的差异

来自YFRobotwiki
跳转至: 导航搜索
 
(未显示1个用户的1个中间版本)
第7行: 第7行:
  
 
Arduino communicates with the shield using the SPI bus. This is on digital pins 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used as SS. On the Mega, the hardware SS pin, 53, is not used to select the W5100, but it must be kept as an output or the SPI interface won't work.  
 
Arduino communicates with the shield using the SPI bus. This is on digital pins 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used as SS. On the Mega, the hardware SS pin, 53, is not used to select the W5100, but it must be kept as an output or the SPI interface won't work.  
 
+
<br><br><br>
 +
[[File:arduino_uno_ethernet_pins.png|500px]]
 +
<br><br><br>
 +
[[File:arduino_mega_ethernet_pins.png|500px]]
 +
<br><br><br><br><br>
  
 
<font color="orange" size="+2">'''Examples'''</font><br>
 
<font color="orange" size="+2">'''Examples'''</font><br>
 +
<br><br>
 +
:-[[ ChatServer]] : set up a simple chat server.
  
 +
:-[[ WebClient]] : make a HTTP request.
  
UDPSendReceiveString: Send and receive text strings via UDP.
+
:-[[ WebClientRepeating]] : Make repeated HTTP requests.
UdpNtpClient: Query a Network Time Protocol (NTP) server using UDP.
+
DnsWebClient: DNS and DHCP-based Web client.
+
DhcpChatServer: A simple DHCP Chat Server
+
DhcpAddressPrinter: Get an IP address via DHCP and print it out
+
TelnetClient: A simple Telnet client
+
  
:-[[ ChatServer]]: set up a simple chat server.
+
:-[[ WebServer]] : host a simple HTML page that displays analog sensor values.
  
:-[[ WebClient]]: make a HTTP request.
+
:-[[ BarometricPressureWebServer]] : outputs the values from a barometric pressure sensor as a web page.
  
:-[[ WebClientRepeating]]: Make repeated HTTP requests.
+
:-[[ UDPSendReceiveString]] : Send and receive text strings via UDP.
  
:-[[ WebServer]]: host a simple HTML page that displays analog sensor values.
+
:-[[ UdpNtpClient]] : Query a Network Time Protocol (NTP) server using UDP.
  
:-[[ BarometricPressureWebServer]]: outputs the values from a barometric pressure sensor as a web page.
+
:-[[ DnsWebClient]] : DNS and DHCP-based Web client.
  
:-[[ UDPSendReceiveString]]: Send and receive text strings via UDP.
+
:-[[ DhcpChatServer]] : A simple DHCP Chat Server
  
:-[[ UdpNtpClient]]: Query a Network Time Protocol (NTP) server using UDP.
+
:-[[ DhcpAddressPrinter]] : Get an IP address via DHCP and print it out
  
:-[[ DnsWebClient]]: DNS and DHCP-based Web client.
+
:-[[ TelnetClient]] : A simple Telnet client  
 
+
:-[[ DhcpChatServer]]: A simple DHCP Chat Server
+
 
+
:-[[ DhcpAddressPrinter]]: Get an IP address via DHCP and print it out
+
 
+
:-[[ TelnetClient]]: A simple Telnet client  
+
  
 
|width="10%" valign="top" align="left"|
 
|width="10%" valign="top" align="left"|
第47行: 第43行:
 
<br><br><br>
 
<br><br><br>
  
<font color="orange" size="+2">'''SD Class'''</font><br>
+
<font color="orange" size="+2">'''Ethernet class'''</font><br><br>
  
'''The SD class provides functions for accessing the SD card and manipulating its files and directories.'''
+
'''The Ethernet class initializes the ethernet library and network settings. '''
  
:-[[SD:begin()| begin()]]
+
:-[[Ethernet.begin()| begin()]]
  
:-[[SD:exists()| exists()]]
+
:-[[Ethernet.localIP()| localIP()]]
  
:-[[SD:mkdir()| mkdir()]]
+
:-[[Ethernet.maintain()| maintain()]]
  
<br><br>
+
<br>
<font color="orange" size="+2">'''File class'''</font><br>
+
<font color="orange" size="+2">'''IPAddress class'''</font><br><br>
  
'''The File class allows for reading from and writing to individual files on the SD card.'''
+
'''The IPAddress class works with local and remote IP addressing. '''
  
:-[[SD:available()| available()]]
+
:-[[Ethernet.IPAddress()()| IPAddress()]]
  
 +
<br>
 +
<font color="orange" size="+2">'''Server class'''</font><br><br>
  
<br><br>
+
'''The Server class creates servers which can send data to and receive data from connected clients (programs running on other computers or devices). '''
<font color="orange" size="+2">'''File class'''</font><br>
+
  
'''The File class allows for reading from and writing to individual files on the SD card.'''
+
:-[[Server.Server()| Server()]]
  
:-[[SD:available()| available()]]
+
:-[[Server.EthernetServer()| EthernetServer()]]
  
:-[[SD:close()| close()]]
+
:-[[Server.begin()| begin()]]
  
:-[[SD:flush()| flush()]]
+
:-[[Server.available()| available()]]
  
:-[[SD:peek()| peek()]]
+
:-[[Server.write()| write()]]
  
:-[[SD:position()| position()]]
+
:-[[Server.print()| print]]
  
:-[[SD:print()| print]]
+
:-[[Server.println()| println()]]
  
:-[[SD:println()| println()]]
+
<br>
 
+
<font color="orange" size="+2">'''Client class'''</font><br><br>
<br><br>
+
<font color="orange" size="+2">'''File class'''</font><br>
+
 
+
'''The File class allows for reading from and writing to individual files on the SD card.'''
+
  
:-[[SD:available()| available()]]
+
'''The client class creates clients that can connect to servers and send and receive data. '''
  
:-[[SD:close()| close()]]
+
:-[[Client.Client()| Client()]]
  
:-[[SD:flush()| flush()]]
+
:-[[Client.EthernetClient()| EthernetClient()]]
  
:-[[SD:peek()| peek()]]
+
:-[[Client.if (EthernetClient)| if (EthernetClient)]]
  
:-[[SD:position()| position()]]
+
:-[[Client.connected()| connected()]]
  
:-[[SD:print()| print]]
+
:-[[Client.connect()| connect()]]
  
:-[[SD:println()| println()]]
+
:-[[Client.write()| write]]
  
:-[[SD:seek()| seek()]]
+
:-[[Client.print()| print]]
  
:-[[SD:size()| size()]]
+
:-[[Client.println()| println()]]
  
:-[[SD:read()| read()]]
+
:-[[Client.available()| available()]]
  
:-[[SD:write()| write()]]
+
:-[[Client.read()| read()]]
  
:-[[SD:isDirectory()| isDirectory()]]
+
:-[[Client.flush()| flush()]]
  
 +
:-[[Client.stop()| stop()]]
  
 
<br>
 
<br>
<font color="orange" size="+2">'''SD Class'''</font><br>
+
<font color="orange" size="+2">'''EthernetUDP class'''</font><br><br>
  
'''The SD class provides functions for accessing the SD card and manipulating its files and directories.'''
+
'''The EthernetUDP class enables UDP message to be sent and received. '''
  
:-[[SD:begin()| begin()]]
+
:-[[EthernetUDP.begin()| begin()]]
  
:-[[SD:exists()| exists()]]
+
:-[[EthernetUDP.read()| read()]]
  
:-[[SD:mkdir()| mkdir()]]
+
:-[[EthernetUDP.write()| write()]]
  
:-[[SD:open()| open()]]
+
:-[[EthernetUDP.beginPacket()| beginPacket()]]
  
:-[[SD:remove()| remove()]]
+
:-[[EthernetUDP.endPacket()| endPacket()]]
  
:-[[SD:rmdir()| rmdir()]]
+
:-[[EthernetUDP.parsePacket()| parsePacket()]]
  
:-[[SD:mkdir()| mkdir()]]
+
:-[[EthernetUDP.available()| available()]]
  
:-[[SD:open()| open()]]
+
:-[[EthernetUDP.stop()| stop()]]
  
:-[[SD:remove()| remove()]]
+
:-[[EthernetUDP.remoteIP()| remoteIP()]]
  
:-[[SD:rmdir()| rmdir()]]
+
:-[[EthernetUDP.remotePort()| remotePort()]]
  
 
|width="10%" valign="top" align="left"|
 
|width="10%" valign="top" align="left"|

2015年7月23日 (四) 23:08的最后版本


With the Arduino Ethernet Shield, this library allows an Arduino board to connect to the internet. It can serve as either a server accepting incoming connections or a client making outgoing ones. The library supports up to four concurrent connection (incoming or outgoing or a combination).

Arduino communicates with the shield using the SPI bus. This is on digital pins 11, 12, and 13 on the Uno and pins 50, 51, and 52 on the Mega. On both boards, pin 10 is used as SS. On the Mega, the hardware SS pin, 53, is not used to select the W5100, but it must be kept as an output or the SPI interface won't work.


Arduino uno ethernet pins.png


Arduino mega ethernet pins.png




Examples


- ChatServer : set up a simple chat server.
- WebClient : make a HTTP request.
- WebClientRepeating : Make repeated HTTP requests.
- WebServer : host a simple HTML page that displays analog sensor values.
- BarometricPressureWebServer : outputs the values from a barometric pressure sensor as a web page.
- UDPSendReceiveString : Send and receive text strings via UDP.
- UdpNtpClient : Query a Network Time Protocol (NTP) server using UDP.
- DnsWebClient : DNS and DHCP-based Web client.
- DhcpChatServer : A simple DHCP Chat Server
- DhcpAddressPrinter : Get an IP address via DHCP and print it out
- TelnetClient : A simple Telnet client




Ethernet class

The Ethernet class initializes the ethernet library and network settings.

- begin()
- localIP()
- maintain()


IPAddress class

The IPAddress class works with local and remote IP addressing.

- IPAddress()


Server class

The Server class creates servers which can send data to and receive data from connected clients (programs running on other computers or devices).

- Server()
- EthernetServer()
- begin()
- available()
- write()
- print
- println()


Client class

The client class creates clients that can connect to servers and send and receive data.

- Client()
- EthernetClient()
- if (EthernetClient)
- connected()
- connect()
- write
- print
- println()
- available()
- read()
- flush()
- stop()


EthernetUDP class

The EthernetUDP class enables UDP message to be sent and received.

- begin()
- read()
- write()
- beginPacket()
- endPacket()
- parsePacket()
- available()
- stop()
- remoteIP()
- remotePort()




返回Arduino库菜单

返回首页

更多建议和问题欢迎反馈至 YFRobot论坛