“Ethernet库”的版本间的差异

来自YFRobotwiki
跳转至: 导航搜索
(以“ {| border="0" cellpadding="10" width="100%" |- |width="30%" valign="top" align="left"| The SD library allows for reading from and writing to SD cards, e.g. on the...”为内容创建页面)
 
 
(未显示1个用户的2个中间版本)
第4行: 第4行:
 
|-
 
|-
 
|width="30%" valign="top" align="left"|
 
|width="30%" valign="top" align="left"|
 +
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).
  
The SD library allows for reading from and writing to SD cards, e.g. on the Arduino Ethernet Shield. It is built on sdfatlib by William
+
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>
  
Greiman. The library supports FAT16 and FAT32 file systems on standard SD cards and SDHC cards. It uses short 8.3 names for files. The
+
<font color="orange" size="+2">'''Examples'''</font><br>
 +
<br><br>
 +
:-[[ ChatServer]] : set up a simple chat server.
  
file names passed to the SD library functions can include paths separated by forward-slashes, /, e.g. "directory/filename.txt". Because
+
:-[[ WebClient]] : make a HTTP request.
  
the working directory is always the root of the SD card, a name refers to the same file whether or not it includes a leading slash (e.g.  
+
:-[[ WebClientRepeating]] : Make repeated HTTP requests.
  
"/file.txt" is equivalent to "file.txt"). As of version 1.0, the library supports opening multiple files.
+
:-[[ WebServer]] : host a simple HTML page that displays analog sensor values.
The communication between the microcontroller and the SD card uses SPI, which takes place on digital pins 11, 12, and 13 (on most
+
  
Arduino boards) or 50, 51, and 52 (Arduino Mega). Additionally, another pin must be used to select the SD card. This can be the hardware
+
:-[[ BarometricPressureWebServer]] : outputs the values from a barometric pressure sensor as a web page.
  
SS pin - pin 10 (on most Arduino boards) or pin 53 (on the Mega) - or another pin specified in the call to SD.begin(). Note that even if
+
:-[[ UDPSendReceiveString]] : Send and receive text strings via UDP.
  
you don't use the hardware SS pin, it must be left as an output or the SD library won't work.
+
:-[[ UdpNtpClient]] : Query a Network Time Protocol (NTP) server using UDP.
  
 +
:-[[ DnsWebClient]] : DNS and DHCP-based Web client.
  
<font color="orange" size="+2">'''Examples'''</font><br>
+
:-[[ DhcpChatServer]] : A simple DHCP Chat Server
  
'''The SD class provides functions for accessing the SD card and manipulating its files and directories.'''
+
:-[[ DhcpAddressPrinter]] : Get an IP address via DHCP and print it out
  
:-[[ Datalogger]]: Log data from three analog sensors to a SD card using the SD library
+
:-[[ TelnetClient]] : A simple Telnet client
 
+
:-[[ DumpFile]]: Read a file from a SD card using the SD library and send it over the serial port
+
 
+
:-[[ Files]]: Create and destroy a file on a SD card
+
 
+
:-[[ ReadWrite]]: Read and write data to and from a file on a SD card
+
 
+
:-[[ CardInfo]]: Get information about a SD card
+
  
 
|width="10%" valign="top" align="left"|
 
|width="10%" valign="top" align="left"|
第43行: 第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()]]
  
:-[[SD:open()| open()]]
+
<br>
 +
<font color="orange" size="+2">'''IPAddress class'''</font><br><br>
  
:-[[SD:remove()| remove()]]
+
'''The IPAddress class works with local and remote IP addressing. '''
  
:-[[SD:rmdir()| rmdir()]]
+
:-[[Ethernet.IPAddress()()| IPAddress()]]
  
<br><br>
+
<br>
<font color="orange" size="+2">'''File class'''</font><br>
+
<font color="orange" size="+2">'''Server class'''</font><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). '''
 +
 
 +
:-[[Server.Server()| Server()]]
 +
 
 +
:-[[Server.EthernetServer()| EthernetServer()]]
 +
 
 +
:-[[Server.begin()| begin()]]
 +
 
 +
:-[[Server.available()| available()]]
 +
 
 +
:-[[Server.write()| write()]]
 +
 
 +
:-[[Server.print()| print]]
 +
 
 +
:-[[Server.println()| println()]]
 +
 
 +
<br>
 +
<font color="orange" size="+2">'''Client class'''</font><br><br>
 +
 
 +
'''The client class creates clients that can connect to servers and send and receive data. '''
 +
 
 +
:-[[Client.Client()| Client()]]
 +
 
 +
:-[[Client.EthernetClient()| EthernetClient()]]
 +
 
 +
:-[[Client.if (EthernetClient)| if (EthernetClient)]]
 +
 
 +
:-[[Client.connected()| connected()]]
 +
 
 +
:-[[Client.connect()| connect()]]
 +
 
 +
:-[[Client.write()| write]]
 +
 
 +
:-[[Client.print()| print]]
 +
 
 +
:-[[Client.println()| println()]]
 +
 
 +
:-[[Client.available()| available()]]
  
'''The File class allows for reading from and writing to individual files on the SD card.'''
+
:-[[Client.read()| read()]]
  
:-[[SD:available()| available()]]
+
:-[[Client.flush()| flush()]]
  
:-[[SD:close()| close()]]
+
:-[[Client.stop()| stop()]]
  
:-[[SD:flush()| flush()]]
+
<br>
 +
<font color="orange" size="+2">'''EthernetUDP class'''</font><br><br>
  
:-[[SD:peek()| peek()]]
+
'''The EthernetUDP class enables UDP message to be sent and received. '''
  
:-[[SD:position()| position()]]
+
:-[[EthernetUDP.begin()| begin()]]
  
:-[[SD:print()| print]]
+
:-[[EthernetUDP.read()| read()]]
  
:-[[SD:println()| println()]]
+
:-[[EthernetUDP.write()| write()]]
  
:-[[SD:seek()| seek()]]
+
:-[[EthernetUDP.beginPacket()| beginPacket()]]
  
:-[[SD:size()| size()]]
+
:-[[EthernetUDP.endPacket()| endPacket()]]
  
:-[[SD:read()| read()]]
+
:-[[EthernetUDP.parsePacket()| parsePacket()]]
  
:-[[SD:write()| write()]]
+
:-[[EthernetUDP.available()| available()]]
  
:-[[SD:isDirectory()| isDirectory()]]
+
:-[[EthernetUDP.stop()| stop()]]
  
:-[[SD:openNextFile()| openNextFile()]]
+
:-[[EthernetUDP.remoteIP()| remoteIP()]]
  
:-[[SD:rewindDirectory()| rewindDirectory()]]
+
:-[[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论坛