From 0d5019a412857e6b221dd45c2c93633c7b62b276 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Sat, 20 Apr 2019 01:32:52 +0200 Subject: [PATCH 01/43] esp8266 arduino core compatibility --- src/Ethernet.cpp | 6 +++++- src/utility/w5100.h | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Ethernet.cpp b/src/Ethernet.cpp index 658bd642..9257090c 100644 --- a/src/Ethernet.cpp +++ b/src/Ethernet.cpp @@ -83,7 +83,11 @@ void EthernetClass::begin(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress g if (W5100.init() == 0) return; SPI.beginTransaction(SPI_ETHERNET_SETTINGS); W5100.setMACAddress(mac); -#if ARDUINO > 106 || TEENSYDUINO > 121 +#ifdef ESP8266 + W5100.setIPAddress(&ip[0]); + W5100.setGatewayIp(&gateway[0]); + W5100.setSubnetMask(&subnet[0]); +#elif ARDUINO > 106 || TEENSYDUINO > 121 W5100.setIPAddress(ip._address.bytes); W5100.setGatewayIp(gateway._address.bytes); W5100.setSubnetMask(subnet._address.bytes); diff --git a/src/utility/w5100.h b/src/utility/w5100.h index e6e01e1a..099556a6 100644 --- a/src/utility/w5100.h +++ b/src/utility/w5100.h @@ -454,6 +454,8 @@ extern W5100Class W5100; #ifndef UTIL_H #define UTIL_H +#ifndef htons + #define htons(x) ( (((x)<<8)&0xFF00) | (((x)>>8)&0xFF) ) #define ntohs(x) htons(x) @@ -463,4 +465,6 @@ extern W5100Class W5100; ((x)>>24 & 0x000000FFUL) ) #define ntohl(x) htonl(x) +#endif // !defined(htons) + #endif From 0dab7b994384afedd00ba23e358ec2bed450c4c6 Mon Sep 17 00:00:00 2001 From: david gauchard Date: Sat, 20 Apr 2019 01:54:31 +0200 Subject: [PATCH 02/43] remove unused warning --- .../BarometricPressureWebServer/BarometricPressureWebServer.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino b/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino index 56ccc66c..1b940f30 100644 --- a/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino +++ b/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino @@ -228,7 +228,7 @@ unsigned int readRegister(byte registerName, int numBytes) { // take the chip select low to select the device: digitalWrite(chipSelectPin, LOW); // send the device the register you want to read: - int command = SPI.transfer(registerName); + /*int command =*/ SPI.transfer(registerName); // send a value of 0 to read the first byte returned: inByte = SPI.transfer(0x00); From 5f64311e27d5c3ff2c38de6f590583833907083e Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 23 Apr 2019 15:26:21 +0200 Subject: [PATCH 03/43] remove useless comment from @per1234 Co-Authored-By: d-a-v --- .../BarometricPressureWebServer/BarometricPressureWebServer.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino b/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino index 1b940f30..99840354 100644 --- a/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino +++ b/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino @@ -228,7 +228,7 @@ unsigned int readRegister(byte registerName, int numBytes) { // take the chip select low to select the device: digitalWrite(chipSelectPin, LOW); // send the device the register you want to read: - /*int command =*/ SPI.transfer(registerName); + SPI.transfer(registerName); // send a value of 0 to read the first byte returned: inByte = SPI.transfer(0x00); From b03683f5b649c7b4ed328feab6db2819ed4974f6 Mon Sep 17 00:00:00 2001 From: taylor Date: Fri, 4 Jan 2019 09:34:39 +0900 Subject: [PATCH 04/43] For Arduino MKR Vidor-4000 --- src/utility/w5100.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utility/w5100.cpp b/src/utility/w5100.cpp index 4ae4ee7a..013e2833 100644 --- a/src/utility/w5100.cpp +++ b/src/utility/w5100.cpp @@ -24,7 +24,7 @@ // MKR boards default to pin 5 for MKR ETH // Pins 8-10 are MOSI/SCK/MISO on MRK, so don't use pin 10 -#elif defined(USE_ARDUINO_MKR_PIN_LAYOUT) || defined(ARDUINO_SAMD_MKRZERO) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKRFox1200) || defined(ARDUINO_SAMD_MKRGSM1400) || defined(ARDUINO_SAMD_MKRWAN1300) +#elif defined(USE_ARDUINO_MKR_PIN_LAYOUT) || defined(ARDUINO_SAMD_MKRZERO) || defined(ARDUINO_SAMD_MKR1000) || defined(ARDUINO_SAMD_MKRFox1200) || defined(ARDUINO_SAMD_MKRGSM1400) || defined(ARDUINO_SAMD_MKRWAN1300) || defined(ARDUINO_SAMD_MKRVIDOR4000) #define SS_PIN_DEFAULT 5 // For boards using AVR, assume shields with SS on pin 10 From 235da471bd7480049c5b8aa5f081e5083c5fd3f2 Mon Sep 17 00:00:00 2001 From: Juraj Andrassy Date: Wed, 23 Sep 2020 19:31:39 +0200 Subject: [PATCH 05/43] PagerServer example - how server.available() and server.print() works --- examples/PagerServer/PagerServer.ino | 69 ++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 examples/PagerServer/PagerServer.ino diff --git a/examples/PagerServer/PagerServer.ino b/examples/PagerServer/PagerServer.ino new file mode 100644 index 00000000..d1b202ce --- /dev/null +++ b/examples/PagerServer/PagerServer.ino @@ -0,0 +1,69 @@ +/* + Pager Server + + A simple server that echoes any incoming messages to all + connected clients. Connect two or more telnet sessions + to see how server.available() and server.print() works. + + created in September 2020 for the Ethernet library + by Juraj Andrassy https://github.com/jandrassy + +*/ +#include + +// Enter a MAC address for your controller below. +// Newer Ethernet shields have a MAC address printed on a sticker on the shield +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; + +// Set the static IP address to use if the DHCP fails to assign +IPAddress ip(192, 168, 0, 177); + +EthernetServer server(2323); + +void setup() { + + Serial.begin(9600); + while (!Serial); + + // start the Ethernet connection: + Serial.println("Initialize Ethernet with DHCP:"); + if (Ethernet.begin(mac) == 0) { + Serial.println("Failed to configure Ethernet using DHCP"); + // Check for Ethernet hardware present + if (Ethernet.hardwareStatus() == EthernetNoHardware) { + Serial.println("Ethernet shield was not found. Sorry, can't run without hardware. :("); + while (true) { + delay(1); // do nothing, no point running without Ethernet hardware + } + } + if (Ethernet.linkStatus() == LinkOFF) { + Serial.println("Ethernet cable is not connected."); + } + // try to congifure using IP address instead of DHCP: + Ethernet.begin(mac, ip); + } else { + Serial.print(" DHCP assigned IP "); + Serial.println(Ethernet.localIP()); + } + + server.begin(); + + IPAddress ip = Ethernet.localIP(); + Serial.println(); + Serial.print("To access the server, connect with Telnet client to "); + Serial.print(ip); + Serial.println(" 2323"); +} + +void loop() { + + EthernetClient client = server.available(); // returns first client which has data to read or a 'false' client + if (client) { // client is true only if it is connected and has data to read + String s = client.readStringUntil('\n'); // read the message incoming from one of the clients + s.trim(); // trim eventual \r + Serial.println(s); // print the message to Serial Monitor + client.print("echo: "); // this is only for the sending client + server.println(s); // send the message to all connected clients + server.flush(); // flush the buffers + } +} From 6b8b320407aa801ff5f32b48cd2e9e70596c9ec2 Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 12 Apr 2021 00:49:06 -0700 Subject: [PATCH 06/43] Configure Dependabot to check for outdated actions used in workflows Dependabot will periodically check the versions of all actions used in the repository's workflows. If any are found to be outdated, it will submit a pull request to update them. NOTE: Dependabot's PRs will sometimes try to pin to the patch version of the action (e.g., updating `uses: foo/bar@v1` to `uses: foo/bar@v2.3.4`). When the action author has provided a major version ref, use that instead (e.g., `uses: foo/bar@v2`). Dependabot will automatically close its PR once the workflow has been updated. More information: https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-dependabot --- .github/dependabot.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..03600dd7 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +# See: https://docs.github.com/en/github/administering-a-repository/configuration-options-for-dependency-updates#about-the-dependabotyml-file +version: 2 + +updates: + # Configure check for outdated GitHub Actions actions in workflows. + # See: https://docs.github.com/en/github/administering-a-repository/keeping-your-actions-up-to-date-with-dependabot + - package-ecosystem: github-actions + directory: / # Check the repository's workflows under /.github/workflows/ + schedule: + interval: daily From 85a14d53f1d3e514b46258e4e1e2d48ae113ae5d Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 12 Apr 2021 00:49:39 -0700 Subject: [PATCH 07/43] Add CI workflow to check for commonly misspelled words On every push, pull request, and periodically, use the codespell-project/actions-codespell action to check for commonly misspelled words. In the event of a false positive, the problematic word should be added, in all lowercase, to the ignore-words-list field of ./.codespellrc. Regardless of the case of the word in the false positive, it must be in all lowercase in the ignore list. The ignore list is comma-separated with no spaces. --- .codespellrc | 7 +++++++ .github/workflows/spell-check.yml | 22 ++++++++++++++++++++++ README.adoc | 9 +++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 .codespellrc create mode 100644 .github/workflows/spell-check.yml diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 00000000..a231f49a --- /dev/null +++ b/.codespellrc @@ -0,0 +1,7 @@ +# See: https://github.com/codespell-project/codespell#using-a-config-file +[codespell] +# In the event of a false positive, add the problematic word, in all lowercase, to a comma-separated list here: +ignore-words-list = nd, +check-filenames = +check-hidden = +skip = ./.git diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml new file mode 100644 index 00000000..01bee879 --- /dev/null +++ b/.github/workflows/spell-check.yml @@ -0,0 +1,22 @@ +name: Spell Check + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + pull_request: + schedule: + # Run every Tuesday at 8 AM UTC to catch new misspelling detections resulting from dictionary updates. + - cron: "0 8 * * TUE" + workflow_dispatch: + repository_dispatch: + +jobs: + spellcheck: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Spell check + uses: codespell-project/actions-codespell@master diff --git a/README.adoc b/README.adoc index 4dfea8da..b8346cb8 100644 --- a/README.adoc +++ b/README.adoc @@ -1,9 +1,14 @@ -= Ethernet Library for Arduino = +:repository-owner: arduino-libraries +:repository-name: Ethernet + += {repository-name} Library for Arduino = + +image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/spell-check.yml/badge.svg["Spell Check status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/spell-check.yml"] With the Arduino Ethernet Shield, this library allows an Arduino board to connect to the internet. For more information about this library please visit us at -https://www.arduino.cc/en/Reference/Ethernet +https://www.arduino.cc/en/Reference/{repository-name} == License == From 4723604c29dafad93268b09a4504aba5caef4fdb Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 12 Apr 2021 01:54:02 -0700 Subject: [PATCH 08/43] Correct typos in comments and documentation --- AUTHORS | 4 +--- .../AdvancedChatServer/AdvancedChatServer.ino | 8 ++++---- .../BarometricPressureWebServer.ino | 18 +++++++++--------- examples/ChatServer/ChatServer.ino | 13 +++++-------- .../DhcpAddressPrinter/DhcpAddressPrinter.ino | 9 ++++----- examples/DhcpChatServer/DhcpChatServer.ino | 9 ++++----- examples/LinkStatus/LinkStatus.ino | 14 +++++++------- examples/TelnetClient/TelnetClient.ino | 16 ++++++---------- .../UDPSendReceiveString.ino | 10 ++++------ examples/UdpNtpClient/UdpNtpClient.ino | 16 +++------------- examples/WebClient/WebClient.ino | 11 +++++------ .../WebClientRepeating/WebClientRepeating.ino | 18 +++++++----------- examples/WebServer/WebServer.ino | 15 +++++++-------- src/Dns.cpp | 5 ++--- src/Dns.h | 2 +- src/Ethernet.h | 8 ++++---- src/EthernetClient.cpp | 6 ++---- src/EthernetUdp.cpp | 3 +-- src/EthernetUdp.h | 2 +- src/socket.cpp | 1 - src/utility/w5100.cpp | 8 ++++---- 21 files changed, 81 insertions(+), 115 deletions(-) diff --git a/AUTHORS b/AUTHORS index 14097dff..0d9fddc7 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,4 +1,3 @@ - Alberto Panu https://github.com/bigjohnson Alasdair Allan https://github.com/aallan Alice Pintus https://github.com/00alis @@ -33,6 +32,5 @@ Richard Sim Scott Fitzgerald https://github.com/shfitz Thibaut Viard https://github.com/aethaniel Tom Igoe https://github.com/tigoe -WizNet http://www.wiznet.co.kr +WIZnet http://www.wiznet.co.kr Zach Eveland https://github.com/zeveland - diff --git a/examples/AdvancedChatServer/AdvancedChatServer.ino b/examples/AdvancedChatServer/AdvancedChatServer.ino index 3b431c88..c97a9589 100644 --- a/examples/AdvancedChatServer/AdvancedChatServer.ino +++ b/examples/AdvancedChatServer/AdvancedChatServer.ino @@ -5,7 +5,7 @@ to all connected clients but the client the message comes from. To use, telnet to your device's IP address and type. You can see the client's input in the serial monitor as well. - Using an Arduino Wiznet Ethernet shield. + Using an Arduino WIZnet Ethernet shield. Circuit: * Ethernet shield attached to pins 10, 11, 12, 13 @@ -42,11 +42,11 @@ EthernetClient clients[8]; void setup() { // You can use Ethernet.init(pin) to configure the CS pin //Ethernet.init(10); // Most Arduino shields - //Ethernet.init(5); // MKR ETH shield + //Ethernet.init(5); // MKR ETH Shield //Ethernet.init(0); // Teensy 2.0 //Ethernet.init(20); // Teensy++ 2.0 - //Ethernet.init(15); // ESP8266 with Adafruit Featherwing Ethernet - //Ethernet.init(33); // ESP32 with Adafruit Featherwing Ethernet + //Ethernet.init(15); // ESP8266 with Adafruit FeatherWing Ethernet + //Ethernet.init(33); // ESP32 with Adafruit FeatherWing Ethernet // initialize the Ethernet device Ethernet.begin(mac, ip, myDns, gateway, subnet); diff --git a/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino b/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino index 99840354..cc1325b2 100644 --- a/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino +++ b/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino @@ -60,11 +60,11 @@ long lastReadingTime = 0; void setup() { // You can use Ethernet.init(pin) to configure the CS pin //Ethernet.init(10); // Most Arduino shields - //Ethernet.init(5); // MKR ETH shield + //Ethernet.init(5); // MKR ETH Shield //Ethernet.init(0); // Teensy 2.0 //Ethernet.init(20); // Teensy++ 2.0 - //Ethernet.init(15); // ESP8266 with Adafruit Featherwing Ethernet - //Ethernet.init(33); // ESP32 with Adafruit Featherwing Ethernet + //Ethernet.init(15); // ESP8266 with Adafruit FeatherWing Ethernet + //Ethernet.init(33); // ESP32 with Adafruit FeatherWing Ethernet // start the SPI library: SPI.begin(); @@ -92,7 +92,7 @@ void setup() { // start listening for clients server.begin(); - // initalize the data ready and chip select pins: + // initialize the data ready and chip select pins: pinMode(dataReadyPin, INPUT); pinMode(chipSelectPin, OUTPUT); @@ -104,7 +104,7 @@ void setup() { // give the sensor and Ethernet shield time to set up: delay(1000); - //Set the sensor to high resolution mode tp start readings: + //Set the sensor to high resolution mode to start readings: writeRegister(0x03, 0x0A); } @@ -131,7 +131,7 @@ void getData() { //Read the temperature data int tempData = readRegister(0x21, 2); - // convert the temperature to celsius and display it: + // convert the temperature to Celsius and display it: temperature = (float)tempData / 20.0; //Read the pressure data highest 3 bits: @@ -155,16 +155,16 @@ void listenForEthernetClients() { EthernetClient client = server.available(); if (client) { Serial.println("Got a client"); - // an http request ends with a blank line + // an HTTP request ends with a blank line bool currentLineIsBlank = true; while (client.connected()) { if (client.available()) { char c = client.read(); // if you've gotten to the end of the line (received a newline - // character) and the line is blank, the http request has ended, + // character) and the line is blank, the HTTP request has ended, // so you can send a reply if (c == '\n' && currentLineIsBlank) { - // send a standard http response header + // send a standard HTTP response header client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println(); diff --git a/examples/ChatServer/ChatServer.ino b/examples/ChatServer/ChatServer.ino index 740d7867..3e280607 100644 --- a/examples/ChatServer/ChatServer.ino +++ b/examples/ChatServer/ChatServer.ino @@ -4,7 +4,7 @@ A simple server that distributes any incoming messages to all connected clients. To use, telnet to your device's IP address and type. You can see the client's input in the serial monitor as well. - Using an Arduino Wiznet Ethernet shield. + Using an Arduino WIZnet Ethernet shield. Circuit: * Ethernet shield attached to pins 10, 11, 12, 13 @@ -37,13 +37,13 @@ bool alreadyConnected = false; // whether or not the client was connected previo void setup() { // You can use Ethernet.init(pin) to configure the CS pin //Ethernet.init(10); // Most Arduino shields - //Ethernet.init(5); // MKR ETH shield + //Ethernet.init(5); // MKR ETH Shield //Ethernet.init(0); // Teensy 2.0 //Ethernet.init(20); // Teensy++ 2.0 - //Ethernet.init(15); // ESP8266 with Adafruit Featherwing Ethernet - //Ethernet.init(33); // ESP32 with Adafruit Featherwing Ethernet + //Ethernet.init(15); // ESP8266 with Adafruit FeatherWing Ethernet + //Ethernet.init(33); // ESP32 with Adafruit FeatherWing Ethernet - // initialize the ethernet device + // initialize the Ethernet device Ethernet.begin(mac, ip, myDns, gateway, subnet); // Open serial communications and wait for port to open: @@ -94,6 +94,3 @@ void loop() { } } } - - - diff --git a/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino b/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino index e40cdfea..4a61bd08 100644 --- a/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino +++ b/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino @@ -3,7 +3,7 @@ This sketch uses the DHCP extensions to the Ethernet library to get an IP address via DHCP and print the address obtained. - using an Arduino Wiznet Ethernet shield. + using an Arduino WIZnet Ethernet shield. Circuit: Ethernet shield attached to pins 10, 11, 12, 13 @@ -28,11 +28,11 @@ byte mac[] = { void setup() { // You can use Ethernet.init(pin) to configure the CS pin //Ethernet.init(10); // Most Arduino shields - //Ethernet.init(5); // MKR ETH shield + //Ethernet.init(5); // MKR ETH Shield //Ethernet.init(0); // Teensy 2.0 //Ethernet.init(20); // Teensy++ 2.0 - //Ethernet.init(15); // ESP8266 with Adafruit Featherwing Ethernet - //Ethernet.init(33); // ESP32 with Adafruit Featherwing Ethernet + //Ethernet.init(15); // ESP8266 with Adafruit FeatherWing Ethernet + //Ethernet.init(33); // ESP32 with Adafruit FeatherWing Ethernet // Open serial communications and wait for port to open: Serial.begin(9600); @@ -92,4 +92,3 @@ void loop() { break; } } - diff --git a/examples/DhcpChatServer/DhcpChatServer.ino b/examples/DhcpChatServer/DhcpChatServer.ino index f4489d61..28e2431a 100644 --- a/examples/DhcpChatServer/DhcpChatServer.ino +++ b/examples/DhcpChatServer/DhcpChatServer.ino @@ -4,7 +4,7 @@ A simple server that distributes any incoming messages to all connected clients. To use, telnet to your device's IP address and type. You can see the client's input in the serial monitor as well. - Using an Arduino Wiznet Ethernet shield. + Using an Arduino WIZnet Ethernet shield. THis version attempts to get an IP address using DHCP @@ -41,11 +41,11 @@ bool gotAMessage = false; // whether or not you got a message from the client ye void setup() { // You can use Ethernet.init(pin) to configure the CS pin //Ethernet.init(10); // Most Arduino shields - //Ethernet.init(5); // MKR ETH shield + //Ethernet.init(5); // MKR ETH Shield //Ethernet.init(0); // Teensy 2.0 //Ethernet.init(20); // Teensy++ 2.0 - //Ethernet.init(15); // ESP8266 with Adafruit Featherwing Ethernet - //Ethernet.init(33); // ESP32 with Adafruit Featherwing Ethernet + //Ethernet.init(15); // ESP8266 with Adafruit FeatherWing Ethernet + //Ethernet.init(33); // ESP32 with Adafruit FeatherWing Ethernet // Open serial communications and wait for port to open: Serial.begin(9600); @@ -99,4 +99,3 @@ void loop() { Ethernet.maintain(); } } - diff --git a/examples/LinkStatus/LinkStatus.ino b/examples/LinkStatus/LinkStatus.ino index af62ebbe..54654dad 100644 --- a/examples/LinkStatus/LinkStatus.ino +++ b/examples/LinkStatus/LinkStatus.ino @@ -1,11 +1,11 @@ /* Link Status - This sketch prints the ethernet link status. When the - ethernet cable is connected the link status should go to "ON". - NOTE: Only WizNet W5200 and W5500 are capable of reporting + This sketch prints the Ethernet link status. When the + Ethernet cable is connected the link status should go to "ON". + NOTE: Only WIZnet W5200 and W5500 are capable of reporting the link status. W5100 will report "Unknown". Hardware: - - Ethernet shield or equivalent board/shield with WizNet 5200/5500 + - Ethernet shield or equivalent board/shield with WIZnet W5200/W5500 Written by Cristian Maglie This example is public domain. */ @@ -16,11 +16,11 @@ void setup() { // You can use Ethernet.init(pin) to configure the CS pin //Ethernet.init(10); // Most Arduino shields - //Ethernet.init(5); // MKR ETH shield + //Ethernet.init(5); // MKR ETH Shield //Ethernet.init(0); // Teensy 2.0 //Ethernet.init(20); // Teensy++ 2.0 - //Ethernet.init(15); // ESP8266 with Adafruit Featherwing Ethernet - //Ethernet.init(33); // ESP32 with Adafruit Featherwing Ethernet + //Ethernet.init(15); // ESP8266 with Adafruit FeatherWing Ethernet + //Ethernet.init(33); // ESP32 with Adafruit FeatherWing Ethernet Serial.begin(9600); } diff --git a/examples/TelnetClient/TelnetClient.ino b/examples/TelnetClient/TelnetClient.ino index 85386b5f..3d015bd0 100644 --- a/examples/TelnetClient/TelnetClient.ino +++ b/examples/TelnetClient/TelnetClient.ino @@ -1,10 +1,10 @@ /* Telnet client - This sketch connects to a a telnet server (http://www.google.com) - using an Arduino Wiznet Ethernet shield. You'll need a telnet server + This sketch connects to a telnet server (http://www.google.com) + using an Arduino WIZnet Ethernet shield. You'll need a telnet server to test this with. - Processing's ChatServer example (part of the network library) works well, + Processing's ChatServer example (part of the Network library) works well, running on port 10002. It can be found as part of the examples in the Processing application, available at http://processing.org/ @@ -39,11 +39,11 @@ EthernetClient client; void setup() { // You can use Ethernet.init(pin) to configure the CS pin //Ethernet.init(10); // Most Arduino shields - //Ethernet.init(5); // MKR ETH shield + //Ethernet.init(5); // MKR ETH Shield //Ethernet.init(0); // Teensy 2.0 //Ethernet.init(20); // Teensy++ 2.0 - //Ethernet.init(15); // ESP8266 with Adafruit Featherwing Ethernet - //Ethernet.init(33); // ESP32 with Adafruit Featherwing Ethernet + //Ethernet.init(15); // ESP8266 with Adafruit FeatherWing Ethernet + //Ethernet.init(33); // ESP32 with Adafruit FeatherWing Ethernet // start the Ethernet connection: Ethernet.begin(mac, ip); @@ -107,7 +107,3 @@ void loop() { } } } - - - - diff --git a/examples/UDPSendReceiveString/UDPSendReceiveString.ino b/examples/UDPSendReceiveString/UDPSendReceiveString.ino index 0c76b022..2a693ff4 100644 --- a/examples/UDPSendReceiveString/UDPSendReceiveString.ino +++ b/examples/UDPSendReceiveString/UDPSendReceiveString.ino @@ -4,7 +4,7 @@ and sends an "acknowledge" string back to the sender A Processing sketch is included at the end of file that can be used to send - and received messages for testing with a computer. + and receive messages for testing with a computer. created 21 Aug 2010 by Michael Margolis @@ -35,11 +35,11 @@ EthernetUDP Udp; void setup() { // You can use Ethernet.init(pin) to configure the CS pin //Ethernet.init(10); // Most Arduino shields - //Ethernet.init(5); // MKR ETH shield + //Ethernet.init(5); // MKR ETH Shield //Ethernet.init(0); // Teensy 2.0 //Ethernet.init(20); // Teensy++ 2.0 - //Ethernet.init(15); // ESP8266 with Adafruit Featherwing Ethernet - //Ethernet.init(33); // ESP32 with Adafruit Featherwing Ethernet + //Ethernet.init(15); // ESP8266 with Adafruit FeatherWing Ethernet + //Ethernet.init(33); // ESP32 with Adafruit FeatherWing Ethernet // start the Ethernet Ethernet.begin(mac, ip); @@ -135,5 +135,3 @@ void loop() { println(); } */ - - diff --git a/examples/UdpNtpClient/UdpNtpClient.ino b/examples/UdpNtpClient/UdpNtpClient.ino index ec52717d..c2adaadf 100644 --- a/examples/UdpNtpClient/UdpNtpClient.ino +++ b/examples/UdpNtpClient/UdpNtpClient.ino @@ -42,11 +42,11 @@ EthernetUDP Udp; void setup() { // You can use Ethernet.init(pin) to configure the CS pin //Ethernet.init(10); // Most Arduino shields - //Ethernet.init(5); // MKR ETH shield + //Ethernet.init(5); // MKR ETH Shield //Ethernet.init(0); // Teensy 2.0 //Ethernet.init(20); // Teensy++ 2.0 - //Ethernet.init(15); // ESP8266 with Adafruit Featherwing Ethernet - //Ethernet.init(33); // ESP32 with Adafruit Featherwing Ethernet + //Ethernet.init(15); // ESP8266 with Adafruit FeatherWing Ethernet + //Ethernet.init(33); // ESP32 with Adafruit FeatherWing Ethernet // Open serial communications and wait for port to open: Serial.begin(9600); @@ -144,13 +144,3 @@ void sendNTPpacket(const char * address) { Udp.write(packetBuffer, NTP_PACKET_SIZE); Udp.endPacket(); } - - - - - - - - - - diff --git a/examples/WebClient/WebClient.ino b/examples/WebClient/WebClient.ino index 45e01eed..9e882292 100644 --- a/examples/WebClient/WebClient.ino +++ b/examples/WebClient/WebClient.ino @@ -2,7 +2,7 @@ Web client This sketch connects to a website (http://www.google.com) - using an Arduino Wiznet Ethernet shield. + using an Arduino WIZnet Ethernet shield. Circuit: * Ethernet shield attached to pins 10, 11, 12, 13 @@ -43,11 +43,11 @@ bool printWebData = true; // set to false for better speed measurement void setup() { // You can use Ethernet.init(pin) to configure the CS pin //Ethernet.init(10); // Most Arduino shields - //Ethernet.init(5); // MKR ETH shield + //Ethernet.init(5); // MKR ETH Shield //Ethernet.init(0); // Teensy 2.0 //Ethernet.init(20); // Teensy++ 2.0 - //Ethernet.init(15); // ESP8266 with Adafruit Featherwing Ethernet - //Ethernet.init(33); // ESP32 with Adafruit Featherwing Ethernet + //Ethernet.init(15); // ESP8266 with Adafruit FeatherWing Ethernet + //Ethernet.init(33); // ESP32 with Adafruit FeatherWing Ethernet // Open serial communications and wait for port to open: Serial.begin(9600); @@ -69,7 +69,7 @@ void setup() { if (Ethernet.linkStatus() == LinkOFF) { Serial.println("Ethernet cable is not connected."); } - // try to congifure using IP address instead of DHCP: + // try to configure using IP address instead of DHCP: Ethernet.begin(mac, ip, myDns); } else { Serial.print(" DHCP assigned IP "); @@ -134,4 +134,3 @@ void loop() { } } } - diff --git a/examples/WebClientRepeating/WebClientRepeating.ino b/examples/WebClientRepeating/WebClientRepeating.ino index 6607f438..5aa0c85f 100644 --- a/examples/WebClientRepeating/WebClientRepeating.ino +++ b/examples/WebClientRepeating/WebClientRepeating.ino @@ -2,9 +2,9 @@ Repeating Web client This sketch connects to a a web server and makes a request - using a Wiznet Ethernet shield. You can use the Arduino Ethernet shield, or + using a WIZnet Ethernet shield. You can use the Arduino Ethernet Shield, or the Adafruit Ethernet shield, either one will work, as long as it's got - a Wiznet Ethernet module on board. + a WIZnet Ethernet module on board. This example uses DNS, by assigning the Ethernet client with a MAC address, IP address, and DNS address. @@ -25,7 +25,7 @@ #include #include -// assign a MAC address for the ethernet controller. +// assign a MAC address for the Ethernet controller. // fill in your address here: byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED @@ -46,11 +46,11 @@ const unsigned long postingInterval = 10*1000; // delay between updates, in mil void setup() { // You can use Ethernet.init(pin) to configure the CS pin //Ethernet.init(10); // Most Arduino shields - //Ethernet.init(5); // MKR ETH shield + //Ethernet.init(5); // MKR ETH Shield //Ethernet.init(0); // Teensy 2.0 //Ethernet.init(20); // Teensy++ 2.0 - //Ethernet.init(15); // ESP8266 with Adafruit Featherwing Ethernet - //Ethernet.init(33); // ESP32 with Adafruit Featherwing Ethernet + //Ethernet.init(15); // ESP8266 with Adafruit FeatherWing Ethernet + //Ethernet.init(33); // ESP32 with Adafruit FeatherWing Ethernet // start serial port: Serial.begin(9600); @@ -72,7 +72,7 @@ void setup() { if (Ethernet.linkStatus() == LinkOFF) { Serial.println("Ethernet cable is not connected."); } - // try to congifure using IP address instead of DHCP: + // try to configure using IP address instead of DHCP: Ethernet.begin(mac, ip, myDns); Serial.print("My IP address: "); Serial.println(Ethernet.localIP()); @@ -124,7 +124,3 @@ void httpRequest() { Serial.println("connection failed"); } } - - - - diff --git a/examples/WebServer/WebServer.ino b/examples/WebServer/WebServer.ino index 06a85576..f5593c73 100644 --- a/examples/WebServer/WebServer.ino +++ b/examples/WebServer/WebServer.ino @@ -2,7 +2,7 @@ Web Server A simple web server that shows the value of the analog input pins. - using an Arduino Wiznet Ethernet shield. + using an Arduino WIZnet Ethernet shield. Circuit: * Ethernet shield attached to pins 10, 11, 12, 13 @@ -35,11 +35,11 @@ EthernetServer server(80); void setup() { // You can use Ethernet.init(pin) to configure the CS pin //Ethernet.init(10); // Most Arduino shields - //Ethernet.init(5); // MKR ETH shield + //Ethernet.init(5); // MKR ETH Shield //Ethernet.init(0); // Teensy 2.0 //Ethernet.init(20); // Teensy++ 2.0 - //Ethernet.init(15); // ESP8266 with Adafruit Featherwing Ethernet - //Ethernet.init(33); // ESP32 with Adafruit Featherwing Ethernet + //Ethernet.init(15); // ESP8266 with Adafruit FeatherWing Ethernet + //Ethernet.init(33); // ESP32 with Adafruit FeatherWing Ethernet // Open serial communications and wait for port to open: Serial.begin(9600); @@ -74,17 +74,17 @@ void loop() { EthernetClient client = server.available(); if (client) { Serial.println("new client"); - // an http request ends with a blank line + // an HTTP request ends with a blank line bool currentLineIsBlank = true; while (client.connected()) { if (client.available()) { char c = client.read(); Serial.write(c); // if you've gotten to the end of the line (received a newline - // character) and the line is blank, the http request has ended, + // character) and the line is blank, the HTTP request has ended, // so you can send a reply if (c == '\n' && currentLineIsBlank) { - // send a standard http response header + // send a standard HTTP response header client.println("HTTP/1.1 200 OK"); client.println("Content-Type: text/html"); client.println("Connection: close"); // the connection will be closed after completion of the response @@ -120,4 +120,3 @@ void loop() { Serial.println("client disconnected"); } } - diff --git a/src/Dns.cpp b/src/Dns.cpp index dfa91125..dca7ce42 100644 --- a/src/Dns.cpp +++ b/src/Dns.cpp @@ -1,4 +1,4 @@ -// Arduino DNS client for WizNet5100-based Ethernet shield +// Arduino DNS client for WIZnet W5100-based Ethernet shield // (c) Copyright 2009-2010 MCQN Ltd. // Released under Apache License, version 2.0 @@ -336,7 +336,7 @@ uint16_t DNSClient::ProcessResponse(uint16_t aTimeout, IPAddress& aAddress) iUdp.flush(); // FIXME return -9;//INVALID_RESPONSE; } - // FIXME: seeems to lock up here on ESP8266, but why?? + // FIXME: seems to lock up here on ESP8266, but why?? iUdp.read(aAddress.raw_address(), 4); return SUCCESS; } else { @@ -351,4 +351,3 @@ uint16_t DNSClient::ProcessResponse(uint16_t aTimeout, IPAddress& aAddress) // If we get here then we haven't found an answer return -10; //INVALID_RESPONSE; } - diff --git a/src/Dns.h b/src/Dns.h index 5f5b30f5..58f9d2c5 100644 --- a/src/Dns.h +++ b/src/Dns.h @@ -1,4 +1,4 @@ -// Arduino DNS client for WizNet5100-based Ethernet shield +// Arduino DNS client for WIZnet W5100-based Ethernet shield // (c) Copyright 2009-2010 MCQN Ltd. // Released under Apache License, version 2.0 diff --git a/src/Ethernet.h b/src/Ethernet.h index 376e6c59..745fa4a3 100644 --- a/src/Ethernet.h +++ b/src/Ethernet.h @@ -39,12 +39,12 @@ #define MAX_SOCK_NUM 8 #endif -// By default, each socket uses 2K buffers inside the Wiznet chip. If +// By default, each socket uses 2K buffers inside the WIZnet chip. If // MAX_SOCK_NUM is set to fewer than the chip's maximum, uncommenting -// this will use larger buffers within the Wiznet chip. Large buffers +// this will use larger buffers within the WIZnet chip. Large buffers // can really help with UDP protocols like Artnet. In theory larger // buffers should allow faster TCP over high-latency links, but this -// does not always seem to work in practice (maybe Wiznet bugs?) +// does not always seem to work in practice (maybe WIZnet bugs?) //#define ETHERNET_LARGE_BUFFERS @@ -84,7 +84,7 @@ class EthernetClass { static EthernetLinkStatus linkStatus(); static EthernetHardwareStatus hardwareStatus(); - // Manaul configuration + // Manual configuration static void begin(uint8_t *mac, IPAddress ip); static void begin(uint8_t *mac, IPAddress ip, IPAddress dns); static void begin(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress gateway); diff --git a/src/EthernetClient.cpp b/src/EthernetClient.cpp index e2406d7d..170f8224 100644 --- a/src/EthernetClient.cpp +++ b/src/EthernetClient.cpp @@ -92,12 +92,12 @@ int EthernetClient::available() { if (sockindex >= MAX_SOCK_NUM) return 0; return Ethernet.socketRecvAvailable(sockindex); - // TODO: do the Wiznet chips automatically retransmit TCP ACK + // TODO: do the WIZnet chips automatically retransmit TCP ACK // packets if they are lost by the network? Someday this should // be checked by a man-in-the-middle test which discards certain // packets. If ACKs aren't resent, we would need to check for // returning 0 here and after a timeout do another Sock_RECV - // command to cause the Wiznet chip to resend the ACK packet. + // command to cause the WIZnet chip to resend the ACK packet. } int EthernetClient::read(uint8_t *buf, size_t size) @@ -211,5 +211,3 @@ uint16_t EthernetClient::remotePort() SPI.endTransaction(); return port; } - - diff --git a/src/EthernetUdp.cpp b/src/EthernetUdp.cpp index 51669d69..e28791f6 100644 --- a/src/EthernetUdp.cpp +++ b/src/EthernetUdp.cpp @@ -1,5 +1,5 @@ /* - * Udp.cpp: Library to send/receive UDP packets with the Arduino ethernet shield. + * Udp.cpp: Library to send/receive UDP packets with the Arduino Ethernet Shield. * This version only offers minimal wrapping of socket.cpp * Drop Udp.h/.cpp into the Ethernet library directory at hardware/libraries/Ethernet/ * @@ -188,4 +188,3 @@ uint8_t EthernetUDP::beginMulticast(IPAddress ip, uint16_t port) _remaining = 0; return 1; } - diff --git a/src/EthernetUdp.h b/src/EthernetUdp.h index 2438ec93..16bb062e 100644 --- a/src/EthernetUdp.h +++ b/src/EthernetUdp.h @@ -1,5 +1,5 @@ /* - * Udp.cpp: Library to send/receive UDP packets with the Arduino ethernet shield. + * Udp.cpp: Library to send/receive UDP packets with the Arduino Ethernet Shield. * This version only offers minimal wrapping of socket.cpp * Drop Udp.h/.cpp into the Ethernet library directory at hardware/libraries/Ethernet/ * diff --git a/src/socket.cpp b/src/socket.cpp index f059dc92..7dc83feb 100644 --- a/src/socket.cpp +++ b/src/socket.cpp @@ -536,4 +536,3 @@ bool EthernetClass::socketSendUDP(uint8_t s) /* Sent ok */ return true; } - diff --git a/src/utility/w5100.cpp b/src/utility/w5100.cpp index 4ae4ee7a..07fcc313 100644 --- a/src/utility/w5100.cpp +++ b/src/utility/w5100.cpp @@ -18,7 +18,7 @@ /***************************************************/ // If variant.h or other headers specifically define the -// default SS pin for ethernet, use it. +// default SS pin for Ethernet, use it. #if defined(PIN_SPI_SS_ETHERNET_LIB) #define SS_PIN_DEFAULT PIN_SPI_SS_ETHERNET_LIB @@ -132,7 +132,7 @@ uint8_t W5100Class::init(void) writeSnRX_SIZE(i, 0); writeSnTX_SIZE(i, 0); } - // Try W5500 next. Wiznet finally seems to have implemented + // Try W5500 next. WIZnet finally seems to have implemented // SPI well with this chip. It appears to be very resilient, // so try it after the fragile W5200 } else if (isW5500()) { @@ -197,12 +197,12 @@ uint8_t W5100Class::init(void) return 1; // successful init } -// Soft reset the Wiznet chip, by writing to its MR register reset bit +// Soft reset the WIZnet chip, by writing to its MR register reset bit uint8_t W5100Class::softReset(void) { uint16_t count=0; - //Serial.println("Wiznet soft reset"); + //Serial.println("WIZnet soft reset"); // write to reset bit writeMR(0x80); // then wait for soft reset to complete From feda5e8c35f091a4b710ecfb9a248c1f1b976cff Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 12 Apr 2021 01:55:28 -0700 Subject: [PATCH 09/43] Add CI workflow to do Arduino project-specific linting On every push, pull request, and periodically, run Arduino Lint to check for common problems not related to the project code. --- .github/workflows/check-arduino.yml | 28 ++++++++++++++++++++++++++++ README.adoc | 1 + 2 files changed, 29 insertions(+) create mode 100644 .github/workflows/check-arduino.yml diff --git a/.github/workflows/check-arduino.yml b/.github/workflows/check-arduino.yml new file mode 100644 index 00000000..0d969f6c --- /dev/null +++ b/.github/workflows/check-arduino.yml @@ -0,0 +1,28 @@ +name: Check Arduino + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + pull_request: + schedule: + # Run every Tuesday at 8 AM UTC to catch breakage caused by new rules added to Arduino Lint. + - cron: "0 8 * * TUE" + workflow_dispatch: + repository_dispatch: + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Arduino Lint + uses: arduino/arduino-lint-action@v1 + with: + compliance: specification + library-manager: update + # Always use this setting for official repositories. Remove for 3rd party projects. + official: true + project-type: library diff --git a/README.adoc b/README.adoc index b8346cb8..ddd604ec 100644 --- a/README.adoc +++ b/README.adoc @@ -3,6 +3,7 @@ = {repository-name} Library for Arduino = +image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-arduino.yml/badge.svg["Check Arduino status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-arduino.yml"] image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/spell-check.yml/badge.svg["Spell Check status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/spell-check.yml"] With the Arduino Ethernet Shield, this library allows an Arduino board to connect to the internet. From 011837cfc266e6f609b0ed48d3cb93732004d689 Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 12 Apr 2021 01:55:59 -0700 Subject: [PATCH 10/43] Add "smoke test" examples compilation CI workflow On every push or pull request that affects library source or example files, and periodically, compile all example sketches for the specified boards. --- .github/workflows/compile-examples.yml | 99 ++++++++++++++++++++++++++ README.adoc | 1 + 2 files changed, 100 insertions(+) create mode 100644 .github/workflows/compile-examples.yml diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml new file mode 100644 index 00000000..534bf7a9 --- /dev/null +++ b/.github/workflows/compile-examples.yml @@ -0,0 +1,99 @@ +name: Compile Examples + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + paths: + - ".github/workflows/compile-examples.yml" + - "examples/**" + - "src/**" + pull_request: + paths: + - ".github/workflows/compile-examples.yml" + - "examples/**" + - "src/**" + schedule: + # Run every Tuesday at 8 AM UTC to catch breakage caused by changes to external resources (libraries, platforms). + - cron: "0 8 * * TUE" + workflow_dispatch: + repository_dispatch: + +jobs: + build: + name: ${{ matrix.board.fqbn }} + runs-on: ubuntu-latest + + strategy: + fail-fast: false + + matrix: + board: + - fqbn: arduino:avr:nano + platforms: | + - name: arduino:avr + - fqbn: arduino:avr:mega + platforms: | + - name: arduino:avr + - fqbn: arduino:avr:leonardo + platforms: | + - name: arduino:avr + - fqbn: arduino:megaavr:uno2018 + platforms: | + - name: arduino:megaavr + - fqbn: arduino:megaavr:nona4809 + platforms: | + - name: arduino:megaavr + - fqbn: arduino:sam:arduino_due_x_dbg + platforms: | + - name: arduino:sam + - fqbn: arduino:samd:arduino_zero_edbg + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkr1000 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrzero + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrwifi1010 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrfox1200 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrwan1300 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrwan1310 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrgsm1400 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrnb1500 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:mkrvidor4000 + platforms: | + - name: arduino:samd + - fqbn: arduino:samd:nano_33_iot + platforms: | + - name: arduino:samd + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Compile examples + uses: arduino/compile-sketches@v1 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + fqbn: ${{ matrix.board.fqbn }} + platforms: ${{ matrix.board.platforms }} + libraries: | + # Install the library from the local path. + - source-path: ./ + # Additional library dependencies can be listed here. + # See: https://github.com/arduino/compile-sketches#libraries + sketch-paths: | + - examples diff --git a/README.adoc b/README.adoc index ddd604ec..ed937b1b 100644 --- a/README.adoc +++ b/README.adoc @@ -4,6 +4,7 @@ = {repository-name} Library for Arduino = image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-arduino.yml/badge.svg["Check Arduino status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/check-arduino.yml"] +image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/compile-examples.yml/badge.svg["Compile Examples status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/compile-examples.yml"] image:https://github.com/{repository-owner}/{repository-name}/actions/workflows/spell-check.yml/badge.svg["Spell Check status", link="https://github.com/{repository-owner}/{repository-name}/actions/workflows/spell-check.yml"] With the Arduino Ethernet Shield, this library allows an Arduino board to connect to the internet. From 753cd95e84192afcbf5bc2e11da5f21d6bbb5c67 Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 12 Apr 2021 01:56:14 -0700 Subject: [PATCH 11/43] Report changes in memory usage that would result from merging a PR On creation or commit to a pull request, a report of the resulting change in memory usage of the examples will be commented to the PR thread. --- .github/workflows/compile-examples.yml | 12 ++++++++++++ .github/workflows/report-size-deltas.yml | 24 ++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 .github/workflows/report-size-deltas.yml diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 534bf7a9..c79085da 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -23,6 +23,9 @@ jobs: name: ${{ matrix.board.fqbn }} runs-on: ubuntu-latest + env: + SKETCHES_REPORTS_PATH: sketches-reports + strategy: fail-fast: false @@ -97,3 +100,12 @@ jobs: # See: https://github.com/arduino/compile-sketches#libraries sketch-paths: | - examples + enable-deltas-report: true + sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} + + - name: Save sketches report as workflow artifact + uses: actions/upload-artifact@v2 + with: + if-no-files-found: error + path: ${{ env.SKETCHES_REPORTS_PATH }} + name: ${{ env.SKETCHES_REPORTS_PATH }} diff --git a/.github/workflows/report-size-deltas.yml b/.github/workflows/report-size-deltas.yml new file mode 100644 index 00000000..652be5d9 --- /dev/null +++ b/.github/workflows/report-size-deltas.yml @@ -0,0 +1,24 @@ +name: Report Size Deltas + +# See: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows +on: + push: + paths: + - ".github/workflows/report-size-deltas.yml" + schedule: + # Run at the minimum interval allowed by GitHub Actions. + # Note: GitHub Actions periodically has outages which result in workflow failures. + # In this event, the workflows will start passing again once the service recovers. + - cron: "*/5 * * * *" + workflow_dispatch: + repository_dispatch: + +jobs: + report: + runs-on: ubuntu-latest + steps: + - name: Comment size deltas reports to PRs + uses: arduino/report-size-deltas@v1 + with: + # The name of the workflow artifact created by the sketch compilation workflow + sketches-reports-source: sketches-reports From 550940306c2d1ead18eb7f788224592acd1c4f12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Tue, 20 Apr 2021 20:49:43 +0000 Subject: [PATCH 12/43] Fix compiler warning in htons --- src/utility/w5100.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/utility/w5100.h b/src/utility/w5100.h index 099556a6..b2e8ec83 100644 --- a/src/utility/w5100.h +++ b/src/utility/w5100.h @@ -455,14 +455,23 @@ extern W5100Class W5100; #define UTIL_H #ifndef htons +// The host order of the Arduino platform is little endian. +// Sometimes it is desired to convert to big endian (or +// network order) -#define htons(x) ( (((x)<<8)&0xFF00) | (((x)>>8)&0xFF) ) +// Host to Network short +#define htons(x) ( (((x)&0xFF)<<8) | (((x)>>8)&0xFF) ) + +// Network to Host short #define ntohs(x) htons(x) +// Host to Network long #define htonl(x) ( ((x)<<24 & 0xFF000000UL) | \ ((x)<< 8 & 0x00FF0000UL) | \ ((x)>> 8 & 0x0000FF00UL) | \ ((x)>>24 & 0x000000FFUL) ) + +// Network to Host long #define ntohl(x) htonl(x) #endif // !defined(htons) From f8209730decd0aae68ac653adfadc9e28b64070d Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Mon, 4 Oct 2021 11:18:42 +0200 Subject: [PATCH 13/43] change links to https if possible (#66) --- AUTHORS | 2 +- examples/TelnetClient/TelnetClient.ino | 2 +- examples/UdpNtpClient/UdpNtpClient.ino | 2 +- examples/WebClientRepeating/WebClientRepeating.ino | 2 +- library.properties | 2 +- src/EthernetClient.cpp | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/AUTHORS b/AUTHORS index 0d9fddc7..1faeec41 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,7 +2,7 @@ Alberto Panu https://github.com/bigjohnson Alasdair Allan https://github.com/aallan Alice Pintus https://github.com/00alis Adrian McEwen https://github.com/amcewen -Arduino LLC http://arduino.cc/ +Arduino LLC https://arduino.cc/ Arnie97 https://github.com/Arnie97 Arturo Guadalupi https://github.com/agdl Bjoern Hartmann https://people.eecs.berkeley.edu/~bjoern/ diff --git a/examples/TelnetClient/TelnetClient.ino b/examples/TelnetClient/TelnetClient.ino index 3d015bd0..42748bf8 100644 --- a/examples/TelnetClient/TelnetClient.ino +++ b/examples/TelnetClient/TelnetClient.ino @@ -7,7 +7,7 @@ Processing's ChatServer example (part of the Network library) works well, running on port 10002. It can be found as part of the examples in the Processing application, available at - http://processing.org/ + https://processing.org/ Circuit: * Ethernet shield attached to pins 10, 11, 12, 13 diff --git a/examples/UdpNtpClient/UdpNtpClient.ino b/examples/UdpNtpClient/UdpNtpClient.ino index c2adaadf..dd801dc8 100644 --- a/examples/UdpNtpClient/UdpNtpClient.ino +++ b/examples/UdpNtpClient/UdpNtpClient.ino @@ -5,7 +5,7 @@ Get the time from a Network Time Protocol (NTP) time server Demonstrates use of UDP sendPacket and ReceivePacket For more on NTP time servers and the messages needed to communicate with them, - see http://en.wikipedia.org/wiki/Network_Time_Protocol + see https://en.wikipedia.org/wiki/Network_Time_Protocol created 4 Sep 2010 by Michael Margolis diff --git a/examples/WebClientRepeating/WebClientRepeating.ino b/examples/WebClientRepeating/WebClientRepeating.ino index 5aa0c85f..ab3cc407 100644 --- a/examples/WebClientRepeating/WebClientRepeating.ino +++ b/examples/WebClientRepeating/WebClientRepeating.ino @@ -17,7 +17,7 @@ modified 21 Jan 2014 by Federico Vanzati - http://www.arduino.cc/en/Tutorial/WebClientRepeating + https://www.arduino.cc/en/Tutorial/WebClientRepeating This code is in the public domain. */ diff --git a/library.properties b/library.properties index de68a94f..dfb280bf 100644 --- a/library.properties +++ b/library.properties @@ -5,6 +5,6 @@ maintainer=Paul Stoffregen , Arduino sentence=Enables network connection (local and Internet) using the Arduino Ethernet Board or Shield. paragraph=With this library you can use the Arduino Ethernet (shield or board) to connect to Internet. The library provides both Client and server functionalities. The library permits you to connect to a local network also with DHCP and to resolve DNS. category=Communication -url=http://www.arduino.cc/en/Reference/Ethernet +url=https://www.arduino.cc/en/Reference/Ethernet architectures=* includes=Ethernet.h diff --git a/src/EthernetClient.cpp b/src/EthernetClient.cpp index 170f8224..9762b56c 100644 --- a/src/EthernetClient.cpp +++ b/src/EthernetClient.cpp @@ -189,7 +189,7 @@ uint16_t EthernetClient::localPort() } // https://github.com/per1234/EthernetMod -// returns the remote IP address: http://forum.arduino.cc/index.php?topic=82416.0 +// returns the remote IP address: https://forum.arduino.cc/index.php?topic=82416.0 IPAddress EthernetClient::remoteIP() { if (sockindex >= MAX_SOCK_NUM) return IPAddress((uint32_t)0); From e435d223bd6963f8f9835572d739adf589cc192e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Mon, 4 Oct 2021 15:23:16 +0200 Subject: [PATCH 14/43] Add docs --- docs/api.md | 2606 ++++++++++++++++++++++++++++++++++++++++++++++++ docs/readme.md | 11 + 2 files changed, 2617 insertions(+) create mode 100644 docs/api.md create mode 100644 docs/readme.md diff --git a/docs/api.md b/docs/api.md new file mode 100644 index 00000000..9bc815d8 --- /dev/null +++ b/docs/api.md @@ -0,0 +1,2606 @@ +# Ethernet Library + +## Ethernet Class + +### `Ethernet.begin()` + +#### Description + +Initializes the ethernet library and network settings. + +With version 1.0, the library supports DHCP. Using Ethernet.begin(mac) with the proper network setup, the Ethernet shield will automatically obtain an IP address. This increases the sketch size significantly. To make sure the DHCP lease is properly renewed when needed, be sure to call Ethernet.maintain() regularly. + + +#### Syntax + +``` +Ethernet.begin(mac); +Ethernet.begin(mac, ip); +Ethernet.begin(mac, ip, dns); +Ethernet.begin(mac, ip, dns, gateway); +Ethernet.begin(mac, ip, dns, gateway, subnet); +``` + +#### Parameters +- mac: the MAC (Media access control) address for the device (array of 6 bytes). this is the Ethernet hardware address of your shield. Newer Arduino Ethernet Shields include a sticker with the device's MAC address. For older shields, choose your own. +- ip: the IP address of the device (array of 4 bytes) +- dns: the IP address of the DNS server (array of 4 bytes). optional: defaults to the device IP address with the last octet set to 1 +- gateway: the IP address of the network gateway (array of 4 bytes). optional: defaults to the device IP address with the last octet set to 1 +- subnet: the subnet mask of the network (array of 4 bytes). optional: defaults to 255.255.255.0 + +#### Returns +The DHCP version of this function, Ethernet.begin(mac), returns an int: 1 on a successful DHCP connection, 0 on failure. The other versions don't return anything. + +#### Example + +``` +#include +#include + +// the media access control (ethernet hardware) address for the shield: +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +//the IP address for the shield: +byte ip[] = { 10, 0, 0, 177 }; + +void setup() +{ + Ethernet.begin(mac, ip); +} + +void loop () {} +``` + +### `Ethernet.dnsServerIP()` + +#### Description + +Returns the DNS server IP address for the device. + + +#### Syntax + +``` +Ethernet.dnsServerIP() + +``` + +#### Parameters +none + +#### Returns +the DNS server IP address for the device (IPAddress). + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); + +void setup() { + Serial.begin(9600); + while (!Serial) { + ; // wait for serial port to connect. Needed for native USB port only + } + + Ethernet.begin(mac, ip); + + Serial.print("The DNS server IP address is: "); + Serial.println(Ethernet.dnsServerIP()); +} + +void loop () {} +``` + +### `Ethernet.gatewayIP()` + +#### Description + +Returns the gateway IP address for the device. + + +#### Syntax + +``` +Ethernet.gatewayIP() + +``` + +#### Parameters +none + +#### Returns +the gateway IP address for the device (IPAddress). + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); + +void setup() { + Serial.begin(9600); + while (!Serial) { + ; // wait for serial port to connect. Needed for native USB port only + } + + Ethernet.begin(mac, ip); + + Serial.print("The gateway IP address is: "); + Serial.println(Ethernet.gatewayIP()); +} + +void loop () {} +``` + +### `Ethernet.hardwareStatus()` + +#### Description + +Ethernet.hardwareStatus() tells you which WIZnet Ethernet controller chip was detected during Ethernet.begin(), if any. This can be used for troubleshooting. If no Ethernet controller was detected then there is likely a hardware problem. + + +#### Syntax + +``` +Ethernet.hardwareStatus() + +``` + +#### Parameters +none + +#### Returns +which WIZnet Ethernet controller chip was detected during Ethernet.begin() (EthernetHardwareStatus): + +``` +EthernetNoHardware +EthernetW5100 +EthernetW5200 +EthernetW5500 +``` + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); + +void setup() { + // Open serial communications and wait for port to open: + Serial.begin(9600); + while (!Serial) { + ; // wait for serial port to connect. Needed for native USB port only + } + + Ethernet.begin(mac, ip); + + if (Ethernet.hardwareStatus() == EthernetNoHardware) { + Serial.println("Ethernet shield was not found."); + } + else if (Ethernet.hardwareStatus() == EthernetW5100) { + Serial.println("W5100 Ethernet controller detected."); + } + else if (Ethernet.hardwareStatus() == EthernetW5200) { + Serial.println("W5200 Ethernet controller detected."); + } + else if (Ethernet.hardwareStatus() == EthernetW5500) { + Serial.println("W5500 Ethernet controller detected."); + } +} + +void loop () {} +``` + +### `Ethernet.init()` + +#### Description + +Used to configure the CS (chip select) pin for the Ethernet controller chip. The Ethernet library has a default CS pin, which is usually correct, but with some non-standard Ethernet hardware you might need to use a different CS pin. + + +#### Syntax + +``` +Ethernet.init(sspin) + +``` + +#### Parameters +sspin: the pin number to use for CS (byte) + +#### Returns +Nothing + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); + +void setup() { + Ethernet.init(53); // use pin 53 for Ethernet CS + Ethernet.begin(mac, ip); +} + +void loop () {} +``` + +### `Ethernet.linkStatus()` + +#### Description + +Tells you whether the link is active. LinkOFF could indicate the Ethernet cable is unplugged or defective. This feature is only available when using the W5200 and W5500 Ethernet controller chips. + + +#### Syntax + +``` +Ethernet.linkStatus() + +``` + +#### Parameters +none + +#### Returns +the link status (EthernetLinkStatus): + +Unknown + +LinkON + +LinkOFF + +#### Example + +``` +#include +#include + +void setup() { + // Open serial communications and wait for port to open: + Serial.begin(9600); + while (!Serial) { + ; // wait for serial port to connect. Needed for native USB port only + } +} + +void loop () { + if (Ethernet.linkStatus() == Unknown) { + Serial.println("Link status unknown. Link status detection is only available with W5200 and W5500."); + } + else if (Ethernet.linkStatus() == LinkON) { + Serial.println("Link status: On"); + } + else if (Ethernet.linkStatus() == LinkOFF) { + Serial.println("Link status: Off"); + } +} +``` + +### `Ethernet.localIP()` + +#### Description + +Obtains the IP address of the Ethernet shield. Useful when the address is auto assigned through DHCP. + + +#### Syntax + +``` +Ethernet.localIP(); + +``` + +#### Parameters +none + +#### Returns +the IP address + +#### Example + +``` +#include +#include + +// Enter a MAC address for your controller below. +// Newer Ethernet shields have a MAC address printed on a sticker on the shield +byte mac[] = { + 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 }; + +// Initialize the Ethernet client library +// with the IP address and port of the server +// that you want to connect to (port 80 is default for HTTP): +EthernetClient client; + +void setup() { + // start the serial library: + Serial.begin(9600); + // start the Ethernet connection: + if (Ethernet.begin(mac) == 0) { + Serial.println("Failed to configure Ethernet using DHCP"); + // no point in carrying on, so do nothing forevermore: + for(;;) + ; + } + // print your local IP address: + Serial.println(Ethernet.localIP()); + +} + +void loop() { + +} +``` + +### `Ethernet.MACAddress()` + +#### Description + +Fills the supplied buffer with the MAC address of the device. + + +#### Syntax + +``` +Ethernet.MACAddress(mac_address) + +``` + +#### Parameters +mac_address: buffer to receive the MAC address (array of 6 bytes) + +#### Returns +Nothing + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); + +void setup() { + Serial.begin(9600); + while (!Serial) { + ; // wait for serial port to connect. Needed for native USB port only + } + + Ethernet.begin(mac, ip); + + byte macBuffer[6]; // create a buffer to hold the MAC address + Ethernet.MACAddress(macBuffer); // fill the buffer + Serial.print("The MAC address is: "); + for (byte octet = 0; octet < 6; octet++) { + Serial.print(macBuffer[octet], HEX); + if (octet < 5) { + Serial.print('-'); + } + } +} + +void loop () {} + +``` + +### `Ethernet.maintain()` + +#### Description + +Allows for the renewal of DHCP leases. When assigned an IP address via DHCP, ethernet devices are given a lease on the address for an amount of time. With Ethernet.maintain(), it is possible to request a renewal from the DHCP server. Depending on the server's configuration, you may receive the same address, a new one, or none at all. + +You can call this function as often as you want, it will only re-request a DHCP lease when needed (returning 0 in all other cases). The easiest way is to just call it on every loop() invocation, but less often is also fine. Not calling this function (or calling it significantly less then once per second) will prevent the lease to be renewed when the DHCP protocol requires this, continuing to use the expired lease instead (which will not directly break connectivity, but if the DHCP server leases the same address to someone else, things will likely break). + +Ethernet.maintain() was added to Arduino 1.0.1. + + +#### Syntax + +``` +Ethernet.maintain(); + +``` + +#### Parameters +none + +#### Returns + +byte: + +0: nothing happened + +1: renew failed + +2: renew success + +3: rebind fail + +4: rebind success + +### `Ethernet.setDnsServerIP()` + +#### Description + +Set the IP address of the DNS server. Not for use with DHCP. + + +#### Syntax + +``` +Ethernet.setDnsServerIP(dns_server) + +``` + +#### Parameters +dns_server: the IP address of the DNS server (IPAddress) + +#### Returns +Nothing + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); +IPAddress myDns(192, 168, 1, 1); + +void setup() { + Ethernet.begin(mac, ip, myDns); + IPAddress newDns(192, 168, 1, 1); + Ethernet.setDnsServerIP(newDns); // change the DNS server IP address +} + +void loop () {} +``` + +### `Ethernet.setGatewayIP()` + +#### Description + +Set the IP address of the network gateway. Not for use with DHCP. + + +#### Syntax + +``` +Ethernet.setGatewayIP(gateway) + +``` + +#### Parameters +gateway: the IP address of the network gateway (IPAddress) + +#### Returns +Nothing + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); +IPAddress myDns(192, 168, 1, 1); +IPAddress gateway(192, 168, 1, 1); + +void setup() { + Ethernet.begin(mac, ip, myDns, gateway); + IPAddress newGateway(192, 168, 100, 1); + Ethernet.setGatewayIP(newGateway); // change the gateway IP address +} + +void loop () {} +``` + +### `Ethernet.setLocalIP()` + +#### Description + +Set the IP address of the device. Not for use with DHCP. + + +#### Syntax + +``` +Ethernet.setLocalIP(local_ip) + +``` + +#### Parameters +local_ip: the IP address to use (IPAddress) + +#### Returns +Nothing + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); + +void setup() { + Ethernet.begin(mac, ip); + IPAddress newIp(10, 0, 0, 178); + Ethernet.setLocalIP(newIp); // change the IP address +} + +void loop () {} +``` + +### `Ethernet.setMACAddress()` + +#### Description + +Set the MAC address. Not for use with DHCP. + + +#### Syntax + +``` +Ethernet.setMACAddress(mac) + +``` + +#### Parameters +mac: the MAC address to use (array of 6 bytes) + +#### Returns +Nothing + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); + +void setup() { + Ethernet.begin(mac, ip); + byte newMac[] = {0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02}; + Ethernet.setMACAddress(newMac); // change the MAC address +} + +void loop () {} +``` + +### `Ethernet.setRetransmissionCount()` + +#### Description + +Set the number of transmission attempts the Ethernet controller will make before giving up. The initial value is 8. 8 transmission attempts times the 200 ms default timeout equals a blocking delay of 1600 ms during a communications failure. You might prefer to set a lower number to make your program more responsive in the event something goes wrong with communications. Despite the name, this sets the total number of transmission attempts (not the number of retries after the first attempt fails) so the minimum value you would ever want to set is 1. + + +#### Syntax + +``` +Ethernet.setRetransmissionCount(number) + +``` + +#### Parameters +number: number of transmission attempts the Ethernet controller should make before giving up (byte) + +#### Returns +Nothing + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); + +void setup() { + Ethernet.begin(mac, ip); + Ethernet.setRetransmissionCount(1); // configure the Ethernet controller to only attempt one transmission before giving up +} + +void loop () {} +``` + +### `Ethernet.setRetransmissionTimeout()` + +#### Description + +Set the Ethernet controller's timeout. The initial value is 200 ms. A 200 ms timeout times the default of 8 attempts equals a blocking delay of 1600 ms during a communications failure. You might prefer to set a shorter timeout to make your program more responsive in the event something goes wrong with communications. You will need to do some experimentation to determine an appropriate value for your specific application. + + +#### Syntax + +``` +Ethernet.setRetransmissionTimeout(milliseconds) + +``` + +#### Parameters +milliseconds: the timeout duration (uint16_t) + +#### Returns +Nothing + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); + +void setup() { + Ethernet.begin(mac, ip); + Ethernet.setRetransmissionTimeout(50); // set the Ethernet controller's timeout to 50 ms +} + +void loop () {} +``` + +### `Ethernet.setSubnetMask()` + +#### Description + +Set the subnet mask of the network. Not for use with DHCP. + + +#### Syntax + +``` +Ethernet.setSubnetMask(subnet) + +``` + +#### Parameters +subnet: the subnet mask of the network (IPAddress) + +#### Returns +Nothing + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); +IPAddress myDns(192, 168, 1, 1); +IPAddress gateway(192, 168, 1, 1); +IPAddress subnet(255, 255, 0, 0); + +void setup() { + Ethernet.begin(mac, ip, myDns, gateway, subnet); + IPAddress newSubnet(255, 255, 255, 0); + Ethernet.setSubnetMask(newSubnet); // change the subnet mask +} + +void loop () {} +``` + +### `Ethernet.subnetMask()` + +#### Description + +Returns the subnet mask of the device. + + +#### Syntax + +``` +Ethernet.subnetMask() + +``` + +#### Parameters +none + +#### Returns +the subnet mask of the device (IPAddress) + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); + +void setup() { + Serial.begin(9600); + while (!Serial) { + ; // wait for serial port to connect. Needed for native USB port only + } + + Ethernet.begin(mac, ip); + + Serial.print("The subnet mask is: "); + Serial.println(Ethernet.subnetMask()); +} + +void loop () {} +``` + +## IPAddress Class + +### `IPAddress()` + +#### Description + +Defines an IP address. It can be used to declare both local and remote addresses. + + +#### Syntax + +``` +IPAddress(address); + +``` + +#### Parameters +address: a comma delimited list representing the address (4 bytes, ex. 192, 168, 1, 1) + +#### Returns +None + +#### Example + +``` +#include +#include + +// network configuration. dns server, gateway and subnet are optional. + + // the media access control (ethernet hardware) address for the shield: +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; + +// the dns server ip +IPAddress dnServer(192, 168, 0, 1); +// the router's gateway address: +IPAddress gateway(192, 168, 0, 1); +// the subnet: +IPAddress subnet(255, 255, 255, 0); + +//the IP address is dependent on your network +IPAddress ip(192, 168, 0, 2); + +void setup() { + Serial.begin(9600); + + // initialize the ethernet device + Ethernet.begin(mac, ip, dnServer, gateway, subnet); + //print out the IP address + Serial.print("IP = "); + Serial.println(Ethernet.localIP()); +} + +void loop() { +} +``` + +## Server Class + +### `Server` + +#### Description +Server is the base class for all Ethernet server based calls. It is not called directly, but invoked whenever you use a function that relies on it. + +### `EthernetServer()` + +#### Description + +Create a server that listens for incoming connections on the specified port. + + +#### Syntax + +``` +Server(port); + +``` + +#### Parameters +port: the port to listen on (int) + +#### Returns +None + +#### Example + +``` +#include +#include + +// network configuration. gateway and subnet are optional. + + // the media access control (ethernet hardware) address for the shield: +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +//the IP address for the shield: +byte ip[] = { 10, 0, 0, 177 }; +// the router's gateway address: +byte gateway[] = { 10, 0, 0, 1 }; +// the subnet: +byte subnet[] = { 255, 255, 0, 0 }; + +// telnet defaults to port 23 +EthernetServer server = EthernetServer(23); + +void setup() +{ + // initialize the ethernet device + Ethernet.begin(mac, ip, gateway, subnet); + + // start listening for clients + server.begin(); +} + +void loop() +{ + // if an incoming client connects, there will be bytes available to read: + EthernetClient client = server.available(); + if (client == true) { + // read bytes from the incoming client and write them back + // to any clients connected to the server: + server.write(client.read()); + } +} +``` + +### `begin()` + +#### Description + +Tells the server to begin listening for incoming connections. + + +#### Syntax + +``` +server.begin() + +``` + +#### Parameters +None + +#### Returns +None + +#### Example + +``` +#include +#include + +// the media access control (ethernet hardware) address for the shield: +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +//the IP address for the shield: +byte ip[] = { 10, 0, 0, 177 }; +// the router's gateway address: +byte gateway[] = { 10, 0, 0, 1 }; +// the subnet: +byte subnet[] = { 255, 255, 0, 0 }; + +// telnet defaults to port 23 +EthernetServer server = EthernetServer(23); + +void setup() +{ + // initialize the ethernet device + Ethernet.begin(mac, ip, gateway, subnet); + + // start listening for clients + server.begin(); +} + +void loop() +{ + // if an incoming client connects, there will be bytes available to read: + EthernetClient client = server.available(); + if (client == true) { + // read bytes from the incoming client and write them back + // to any clients connected to the server: + server.write(client.read()); + } +} +``` + +### `accept()` + +#### Description + +The traditional server.available() function would only tell you of a new client after it sent data, which makes some protocols like FTP impossible to properly implement. + +The intention is programs will use either available() or accept(), but not both. With available(), the client connection continues to be managed by EthernetServer. You don’t need to keep a client object, since calling available() will give you whatever client has sent data. Simple servers can be written with very little code using available(). + +With accept(), EthernetServer gives you the client only once, regardless of whether it has sent any data. You must keep track of the connected clients. This requires more code, but you gain more control. + + +#### Syntax + +``` +server.accept() + +``` + +#### Parameters +none + +#### Returns +a Client object. If no client has data available for reading, this object will evaluate to false in an if-statement. (EthernetClient). + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(192, 168, 69, 104); + +// telnet defaults to port 23 +EthernetServer server(23); + +EthernetClient clients[8]; + +void setup() { + Ethernet.begin(mac, ip); + + // Open serial communications and wait for port to open: + Serial.begin(9600); + while (!Serial) { + ; // wait for serial port to connect. Needed for native USB port only + } + + // start listening for clients + server.begin(); +} + +void loop() { + // check for any new client connecting, and say hello (before any incoming data) + EthernetClient newClient = server.accept(); + if (newClient) { + for (byte i = 0; i < 8; i++) { + if (!clients[i]) { + newClient.print("Hello, client number: "); + newClient.println(i); + // Once we "accept", the client is no longer tracked by EthernetServer + // so we must store it into our list of clients + clients[i] = newClient; + break; + } + } + } + + // check for incoming data from all clients + for (byte i = 0; i < 8; i++) { + while (clients[i] && clients[i].available() > 0) { + // read incoming data from the client + Serial.write(clients[i].read()); + } + } + + // stop any clients which disconnect + for (byte i = 0; i < 8; i++) { + if (clients[i] && !clients[i].connected()) { + clients[i].stop(); + } + } +} +``` + +### `available()` + +#### Description + +Gets a client that is connected to the server and has data available for reading. The connection persists when the returned client object goes out of scope; you can close it by calling client.stop(). + + +#### Syntax + +``` +server.available() + +``` + +#### Parameters +None + +#### Returns +a Client object; if no Client has data available for reading, this object will evaluate to false in an if-statement (see the example below) + +#### Example + +``` +#include +#include + +// the media access control (ethernet hardware) address for the shield: +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +//the IP address for the shield: +byte ip[] = { 10, 0, 0, 177 }; +// the router's gateway address: +byte gateway[] = { 10, 0, 0, 1 }; +// the subnet: +byte subnet[] = { 255, 255, 0, 0 }; + + +// telnet defaults to port 23 +EthernetServer server = EthernetServer(23); + +void setup() +{ + // initialize the ethernet device + Ethernet.begin(mac, ip, gateway, subnet); + + // start listening for clients + server.begin(); +} + +void loop() +{ + // if an incoming client connects, there will be bytes available to read: + EthernetClient client = server.available(); + if (client) { + // read bytes from the incoming client and write them back + // to any clients connected to the server: + server.write(client.read()); + } +} +``` + +### `if(server)` + +#### Description +Indicates whether the server is listening for new clients. You can use this to detect whether server.begin() was successful. It can also tell you when no more sockets are available to listen for more clients, because the maximum number have connected. + + +#### Syntax + +``` +if(server) + +``` + +#### Parameters +none + +#### Returns +whether the server is listening for new clients (bool). + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); + +// telnet defaults to port 23 +EthernetServer server = EthernetServer(23); + +void setup() { + // Open serial communications and wait for port to open: + Serial.begin(9600); + while (!Serial) { + ; // wait for serial port to connect. Needed for native USB port only + } + + // initialize the Ethernet device + Ethernet.begin(mac, ip); + + // start listening for clients + server.begin(); +} + +void loop() { + if (server) { + Serial.println("Server is listening"); + } + else { + Serial.println("Server is not listening"); + } +} +``` + +### `write()` + +#### Description + +Write data to all the clients connected to a server. This data is sent as a byte or series of bytes. + + +#### Syntax + +``` +server.write(val) +server.write(buf, len) + +``` + +#### Parameters +val: a value to send as a single byte (byte or char) + +buf: an array to send as a series of bytes (byte or char) + +len: the length of the buffer + +#### Returns +byte +write() returns the number of bytes written. It is not necessary to read this. + +#### Example + +``` +#include +#include + +// network configuration. gateway and subnet are optional. + + // the media access control (ethernet hardware) address for the shield: +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +//the IP address for the shield: +byte ip[] = { 10, 0, 0, 177 }; +// the router's gateway address: +byte gateway[] = { 10, 0, 0, 1 }; +// the subnet: +byte subnet[] = { 255, 255, 0, 0 }; + +// telnet defaults to port 23 +EthernetServer server = EthernetServer(23); + +void setup() +{ + // initialize the ethernet device + Ethernet.begin(mac, ip, gateway, subnet); + + // start listening for clients + server.begin(); +} + +void loop() +{ + // if an incoming client connects, there will be bytes available to read: + EthernetClient client = server.available(); + if (client == true) { + // read bytes from the incoming client and write them back + // to any clients connected to the server: + server.write(client.read()); + } +} +``` + +### `print()` + +#### Description + +Print data to all the clients connected to a server. Prints numbers as a sequence of digits, each an ASCII character (e.g. the number 123 is sent as the three characters '1', '2', '3'). + + +#### Syntax + +``` +server.print(data) +server.print(data, BASE) + +``` + +#### Parameters +data: the data to print (char, byte, int, long, or string) + +BASE (optional): the base in which to print numbers: BIN for binary (base 2), DEC for decimal (base 10), OCT for octal (base 8), HEX for hexadecimal (base 16). + +#### Returns +byte +print() will return the number of bytes written, though reading that number is optional + + +### `println()` + +#### Description + +Print data, followed by a newline, to all the clients connected to a server. Prints numbers as a sequence of digits, each an ASCII character (e.g. the number 123 is sent as the three characters '1', '2', '3'). + + +#### Syntax + +``` +server.println() +server.println(data) +server.println(data, BASE) + +``` + +#### Parameters +data (optional): the data to print (char, byte, int, long, or string) + +BASE (optional): the base in which to print numbers: BIN for binary (base 2), DEC for decimal (base 10), OCT for octal (base 8), HEX for hexadecimal (base 16). + +#### Returns +byte + +println() will return the number of bytes written, though reading that number is optional + +## Client Class + +### `Client` + +#### Description +Client is the base class for all Ethernet client based calls. It is not called directly, but invoked whenever you use a function that relies on it. + +### `EthernetClient()` + +#### Description + +Creates a client which can connect to a specified internet IP address and port (defined in the client.connect() function). + + +#### Syntax + +``` +EthernetClient() + +``` + +#### Parameters +None + +#### Example + +``` +#include +#include + + +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +byte ip[] = { 10, 0, 0, 177 }; +byte server[] = { 64, 233, 187, 99 }; // Google + +EthernetClient client; + +void setup() +{ + Ethernet.begin(mac, ip); + Serial.begin(9600); + + delay(1000); + + Serial.println("connecting..."); + + if (client.connect(server, 80)) { + Serial.println("connected"); + client.println("GET /search?q=arduino HTTP/1.0"); + client.println(); + } else { + Serial.println("connection failed"); + } +} + +void loop() +{ + if (client.available()) { + char c = client.read(); + Serial.print(c); + } + + if (!client.connected()) { + Serial.println(); + Serial.println("disconnecting."); + client.stop(); + for(;;) + ; + } +} +``` + +### `if (EthernetClient)` + +#### Description +Indicates if the specified Ethernet client is ready. + + +#### Syntax + +``` +if (client) + +``` + +#### Parameters +none + +#### Returns +boolean : returns true if the specified client is available. + +#### Example + +``` +#include +#include + + +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +byte ip[] = { 10, 0, 0, 177 }; +byte server[] = { 64, 233, 187, 99 }; // Google + +EthernetClient client; + +void setup() +{ + Ethernet.begin(mac, ip); + Serial.begin(9600); + + delay(1000); + + Serial.println("connecting..."); + while(!client){ + ; // wait until there is a client connected to proceed + } + if (client.connect(server, 80)) { + Serial.println("connected"); + client.println("GET /search?q=arduino HTTP/1.0"); + client.println(); + } else { + Serial.println("connection failed"); + } +} + +void loop() +{ + if (client.available()) { + char c = client.read(); + Serial.print(c); + } + + if (!client.connected()) { + Serial.println(); + Serial.println("disconnecting."); + client.stop(); + for(;;) + ; + } +} + +``` + +### `connected()` + +#### Description + +Whether or not the client is connected. Note that a client is considered connected if the connection has been closed but there is still unread data. + + +#### Syntax + +``` +client.connected() + +``` + +#### Parameters +none + +#### Returns +Returns true if the client is connected, false if not. + +#### Example + +``` +#include +#include + +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +byte ip[] = { 10, 0, 0, 177 }; +byte server[] = { 64, 233, 187, 99 }; // Google + +EthernetClient client; + +void setup() +{ + Ethernet.begin(mac, ip); + Serial.begin(9600); + client.connect(server, 80); + delay(1000); + + Serial.println("connecting..."); + + if (client.connected()) { + Serial.println("connected"); + client.println("GET /search?q=arduino HTTP/1.0"); + client.println(); + } else { + Serial.println("connection failed"); + } +} + +void loop() +{ + if (client.available()) { + char c = client.read(); + Serial.print(c); + } + + if (!client.connected()) { + Serial.println(); + Serial.println("disconnecting."); + client.stop(); + for(;;) + ; + } +} +``` + +### `connect()` + +#### Description + +Connects to a specified IP address and port. The return value indicates success or failure. Also supports DNS lookups when using a domain name. + + +#### Syntax + +``` +client.connect() +client.connect(ip, port) +client.connect(URL, port) + +``` + +#### Parameters +ip: the IP address that the client will connect to (array of 4 bytes) + +URL: the domain name the client will connect to (string, ex.:"arduino.cc") + +port: the port that the client will connect to (int) + +#### Returns +Returns an int (1,-1,-2,-3,-4) indicating connection status : + +SUCCESS 1 +TIMED_OUT -1 +INVALID_SERVER -2 +TRUNCATED -3 +INVALID_RESPONSE -4 +#### Example + +``` +#include +#include + +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +byte ip[] = { 10, 0, 0, 177 }; +byte server[] = { 64, 233, 187, 99 }; // Google + +EthernetClient client; + +void setup() +{ + Ethernet.begin(mac, ip); + Serial.begin(9600); + + delay(1000); + + Serial.println("connecting..."); + + if (client.connect(server, 80)) { + Serial.println("connected"); + client.println("GET /search?q=arduino HTTP/1.0"); + client.println(); + } else { + Serial.println("connection failed"); + } +} + +void loop() +{ + if (client.available()) { + char c = client.read(); + Serial.print(c); + } + + if (!client.connected()) { + Serial.println(); + Serial.println("disconnecting."); + client.stop(); + for(;;) + ; + } +} +``` + +### `localPort()` + +#### Description + +Returns the local port number the client is connected to. + + +#### Syntax + +``` +client.localPort + +``` + +#### Parameters +none + +#### Returns +the local port number the client is connected to (uint16_t). + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); + +// telnet defaults to port 23 +EthernetServer server = EthernetServer(23); + +void setup() { + // Open serial communications and wait for port to open: + Serial.begin(9600); + while (!Serial) { + ; // wait for serial port to connect. Needed for native USB port only + } + + // initialize the Ethernet device + Ethernet.begin(mac, ip); + + // start listening for clients + server.begin(); +} + +void loop() { + // if an incoming client connects, there will be bytes available to read: + EthernetClient client = server.available(); + if (client) { + Serial.print("Client is connected on port: "); + Serial.println(client.localPort()); + client.stop(); + } +} +``` + +### `remoteIP()` + +#### Description + +Returns the IP address of the client. + + +#### Syntax + +``` +client.remoteIP() + +``` + +#### Parameters +none + +#### Returns +the client's IP address (IPAddress). + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); + +// telnet defaults to port 23 +EthernetServer server = EthernetServer(23); + +void setup() { + // Open serial communications and wait for port to open: + Serial.begin(9600); + while (!Serial) { + ; // wait for serial port to connect. Needed for native USB port only + } + + // initialize the Ethernet device + Ethernet.begin(mac, ip); + + // start listening for clients + server.begin(); +} + +void loop() { + // if an incoming client connects, there will be bytes available to read: + EthernetClient client = server.available(); + if (client) { + Serial.print("Remote IP address: "); + Serial.println(client.remoteIP()); + client.stop(); + } +} +``` + +### `remotePort()` + +#### Description + +Returns the port of the host that sent the current incoming packet. + + +#### Syntax + +``` +client.remotePort() + +``` + +#### Parameters +none + +#### Returns +the port of the host that sent the current incoming packet (uint16_t). + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); + +// telnet defaults to port 23 +EthernetServer server = EthernetServer(23); + +void setup() { + // Open serial communications and wait for port to open: + Serial.begin(9600); + while (!Serial) { + ; // wait for serial port to connect. Needed for native USB port only + } + + // initialize the Ethernet device + Ethernet.begin(mac, ip); + + // start listening for clients + server.begin(); +} + +void loop() { + // if an incoming client connects, there will be bytes available to read: + EthernetClient client = server.available(); + if (client) { + Serial.print("Remote port: "); + Serial.println(client.remotePort()); + client.stop(); + } +} +``` + +### `setConnectionTimeout()` + +#### Description + +Set the timeout for client.connect() and client.stop(). The initial value is 1000 ms. You might prefer to set a lower timeout value to make your program more responsive in the event something goes wrong. + + +#### Syntax + +``` +client.setConnectionTimeout(milliseconds) + +``` + +#### Parameters +milliseconds: the timeout duration for client.connect() and client.stop() (uint16_t) + +#### Returns +Nothing + +#### Example + +``` +#include +#include + +byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; +IPAddress ip(10, 0, 0, 177); + +// telnet defaults to port 23 +EthernetServer server = EthernetServer(23); + +void setup() { + // Open serial communications and wait for port to open: + Serial.begin(9600); + while (!Serial) { + ; // wait for serial port to connect. Needed for native USB port only + } + + // initialize the Ethernet device + Ethernet.begin(mac, ip); + + // start listening for clients + server.begin(); +} + +void loop() { + // if an incoming client connects, there will be bytes available to read: + EthernetClient client = server.available(); + if (client) { + client.setConnectionTimeout(100); // set the timeout duration for client.connect() and client.stop() + } +} +``` + +### `write()` + +#### Description + +Write data to the server the client is connected to. This data is sent as a byte or series of bytes. + + +#### Syntax + +``` +client.write(val) +client.write(buf, len) + +``` + +#### Parameters +val: a value to send as a single byte (byte or char) + +buf: an array to send as a series of bytes (byte or char) + +len: the length of the buffer + +#### Returns +byte +write() returns the number of bytes written. It is not necessary to read this value. + +### `print()` + +#### Description + +Print data to the server that a client is connected to. Prints numbers as a sequence of digits, each an ASCII character (e.g. the number 123 is sent as the three characters '1', '2', '3'). + + +#### Syntax + +``` +client.print(data) +client.print(data, BASE) + +``` + +#### Parameters +data: the data to print (char, byte, int, long, or string) + +BASE (optional): the base in which to print numbers: DEC for decimal (base 10), OCT for octal (base 8), HEX for hexadecimal (base 16). +#### Returns +byte: returns the number of bytes written, though reading that number is optional + +### `println()` + +#### Description + +Print data, followed by a carriage return and newline, to the server a client is connected to. Prints numbers as a sequence of digits, each an ASCII character (e.g. the number 123 is sent as the three characters '1', '2', '3'). + + +#### Syntax + +``` +client.println() +client.println(data) +client.print(data, BASE) + +``` + +#### Parameters +data (optional): the data to print (char, byte, int, long, or string) + +BASE (optional): the base in which to print numbers: DEC for decimal (base 10), OCT for octal (base 8), HEX for hexadecimal (base 16). + +#### Returns +byte: return the number of bytes written, though reading that number is optional + + +### `available()` + +#### Description + +Returns the number of bytes available for reading (that is, the amount of data that has been written to the client by the server it is connected to). + +available() inherits from the Stream utility class. + + +#### Syntax + +``` +client.available() + +``` + +#### Parameters +none + +#### Returns +The number of bytes available. + +#### Example + +``` +#include +#include + +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +byte ip[] = { 10, 0, 0, 177 }; +byte server[] = { 64, 233, 187, 99 }; // Google + +EthernetClient client; + +void setup() +{ + Ethernet.begin(mac, ip); + Serial.begin(9600); + + delay(1000); + + Serial.println("connecting..."); + + if (client.connect(server, 80)) { + Serial.println("connected"); + client.println("GET /search?q=arduino HTTP/1.0"); + client.println(); + } else { + Serial.println("connection failed"); + } +} + +void loop() +{ + if (client.available()) { + char c = client.read(); + Serial.print(c); + } + + if (!client.connected()) { + Serial.println(); + Serial.println("disconnecting."); + client.stop(); + for(;;) + ; + } +} +``` + +### `read()` + +#### Description + +Read the next byte received from the server the client is connected to (after the last call to read()). + +read() inherits from the Stream utility class. + + +#### Syntax + +``` +client.read() + +``` + +#### Parameters +none + +#### Returns +The next byte (or character), or -1 if none is available. + +flush() +Waits until all outgoing characters in buffer have been sent. + +flush() inherits from the Stream utility class. + + +#### Syntax + +``` +client.flush() + +``` + +#### Parameters +none + +#### Returns +none + +### `stop()` + +#### Description + +Disconnect from the server. + + +#### Syntax + +``` +client.stop() + +``` + +#### Parameters +none + +#### Returns +none + +# EthernetUDP Class + +### `UDP.begin()` + +#### Description +Initializes the ethernet UDP library and network settings. + + +#### Syntax + +``` +EthernetUDP.begin(localPort); +``` + +#### Parameters +localPort: the local port to listen on (int) + +#### Returns +1 if successful, 0 if there are no sockets available to use. + +#### Example + +``` + +#include + +#include + +#include + + + +// Enter a MAC address and IP address for your controller below. + +// The IP address will be dependent on your local network: + +byte mac[] = { + + 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; + +IPAddress ip(192, 168, 1, 177); + + + +unsigned int localPort = 8888; // local port to listen on + + + +// An EthernetUDP instance to let us send and receive packets over UDP + +EthernetUDP Udp; + + + +void setup() { + + // start the Ethernet and UDP: + + Ethernet.begin(mac,ip); + + Udp.begin(localPort); + + + +} + + + +void loop() { +} + + +``` + +### `UDP.read()` + +#### Description +Reads UDP data from the specified buffer. If no arguments are given, it will return the next character in the buffer. + +This function can only be successfully called after UDP.parsePacket(). + + +#### Syntax + +``` +UDP.read(); +UDP.read(packetBuffer, MaxSize); +``` + +#### Parameters +packetBuffer: buffer to hold incoming packets (char) +MaxSize: maximum size of the buffer (int) + +#### Returns +char : returns the characters in the buffer + +#### Example + +``` +#include +#include +#include + +// Enter a MAC address and IP address for your controller below. +// The IP address will be dependent on your local network: +byte mac[] = { + 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +IPAddress ip(192, 168, 1, 177); + +unsigned int localPort = 8888; // local port to listen on + +// An EthernetUDP instance to let us send and receive packets over UDP +EthernetUDP Udp; + +char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; //buffer to hold incoming packet, + +void setup() { + // start the Ethernet and UDP: + Ethernet.begin(mac,ip); + Udp.begin(localPort); + +} + +void loop() { + + int packetSize = Udp.parsePacket(); + if(packetSize) + { + Serial.print("Received packet of size "); + Serial.println(packetSize); + Serial.print("From "); + IPAddress remote = Udp.remoteIP(); + for (int i =0; i < 4; i++) + { + Serial.print(remote[i], DEC); + if (i < 3) + { + Serial.print("."); + } + } + Serial.print(", port "); + Serial.println(Udp.remotePort()); + + // read the packet into packetBufffer + Udp.read(packetBuffer,UDP_TX_PACKET_MAX_SIZE); + Serial.println("Contents:"); + Serial.println(packetBuffer); +} +} +``` + +### `UDP.write()` + +#### Description +Writes UDP data to the remote connection. Must be wrapped between beginPacket() and endPacket(). beginPacket() initializes the packet of data, it is not sent until endPacket() is called. + + +#### Syntax + +``` +UDP.write(message); +UDP.write(buffer, size); + +``` + +#### Parameters + +message: the outgoing message (char) + +buffer: an array to send as a series of bytes (byte or char) + +size: the length of the buffer + +#### Returns +byte : returns the number of characters sent. This does not have to be read + +#### Example + +``` + + + +#include + +#include + +#include + + + +// Enter a MAC address and IP address for your controller below. + +// The IP address will be dependent on your local network: + +byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; + +IPAddress ip(192, 168, 1, 177); + + + +unsigned int localPort = 8888; // local port to listen on + + + +// An EthernetUDP instance to let us send and receive packets over UDP + +EthernetUDP Udp; + + + +void setup() { + + // start the Ethernet and UDP: + + Ethernet.begin(mac,ip); + + Udp.begin(localPort); + +} + + + +void loop() { + + Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); + + Udp.write("hello"); + + Udp.endPacket(); + +} + + +``` + +### `UDP.beginPacket()` + +#### Description +Starts a connection to write UDP data to the remote connection + + +#### Syntax + +``` +UDP.beginPacket(remoteIP, remotePort); +``` + +#### Parameters +- remoteIP: the IP address of the remote connection (4 bytes) +- remotePort: the port of the remote connection (int) +#### Returns +Returns an int: 1 if successful, 0 if there was a problem resolving the hostname or port. + +#### Example + +``` +#include +#include +#include + +// Enter a MAC address and IP address for your controller below. +// The IP address will be dependent on your local network: +byte mac[] = { + 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +IPAddress ip(192, 168, 1, 177); + +unsigned int localPort = 8888; // local port to listen on + +// An EthernetUDP instance to let us send and receive packets over UDP +EthernetUDP Udp; + +void setup() { + // start the Ethernet and UDP: + Ethernet.begin(mac,ip); + Udp.begin(localPort); + +} + +void loop() { + + Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); + Udp.write("hello"); + Udp.endPacket(); + +} +``` + +### `UDP.endPacket()` + +#### Description +Called after writing UDP data to the remote connection. + + +#### Syntax + +``` +UDP.endPacket(); +``` + +#### Parameters +None + +#### Returns +Returns an int: 1 if the packet was sent successfully, 0 if there was an error + +#### Example + +``` +#include +#include +#include + +// Enter a MAC address and IP address for your controller below. +// The IP address will be dependent on your local network: +byte mac[] = { + 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +IPAddress ip(192, 168, 1, 177); + +unsigned int localPort = 8888; // local port to listen on + +// An EthernetUDP instance to let us send and receive packets over UDP +EthernetUDP Udp; + +void setup() { + // start the Ethernet and UDP: + Ethernet.begin(mac,ip); + Udp.begin(localPort); + +} + +void loop() { + + Udp.beginPacket(Udp.remoteIP(), Udp.remotePort()); + Udp.write("hello"); + Udp.endPacket(); + +} +``` + +### `UDP.parsePacket()` + +#### Description +Checks for the presence of a UDP packet, and reports the size. parsePacket() must be called before reading the buffer with UDP.read(). + + +#### Syntax + +``` +UDP.parsePacket(); +``` + +#### Parameters +None + +#### Returns +int: the size of a received UDP packet + +#### Example + +``` + +#include // needed for Arduino versions later than 0018 +#include +#include // UDP library from: bjoern@cs.stanford.edu 12/30/2008 + + +// Enter a MAC address and IP address for your controller below. +// The IP address will be dependent on your local network: +byte mac[] = { + 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +IPAddress ip(192, 168, 1, 177); + +unsigned int localPort = 8888; // local port to listen on + +// An EthernetUDP instance to let us send and receive packets over UDP +EthernetUDP Udp; + +void setup() { + // start the Ethernet and UDP: + Ethernet.begin(mac,ip); + Udp.begin(localPort); + + Serial.begin(9600); +} + +void loop() { + // if there's data available, read a packet + int packetSize = Udp.parsePacket(); + if(packetSize) + { + Serial.print("Received packet of size "); + Serial.println(packetSize); + } + delay(10); +} +``` + +### `UDP.available()` + +#### Description + +Get the number of bytes (characters) available for reading from the buffer. This is data that's already arrived. + +This function can only be successfully called after UDP.parsePacket(). + +available() inherits from the Stream utility class. + + +#### Syntax + +``` +UDP.available() + +``` + +#### Parameters +None + +#### Returns +the number of bytes available to read + +#### Example + +``` +#include +#include +#include + +// Enter a MAC address and IP address for your controller below. +// The IP address will be dependent on your local network: +byte mac[] = { + 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +IPAddress ip(192, 168, 1, 177); + +unsigned int localPort = 8888; // local port to listen on + +// An EthernetUDP instance to let us send and receive packets over UDP +EthernetUDP Udp; + +char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; //buffer to hold incoming packet, + +void setup() { + // start the Ethernet and UDP: + Ethernet.begin(mac,ip); + Udp.begin(localPort); + +} + +void loop() { + + int packetSize = Udp.parsePacket(); + if(Udp.available()) + { + Serial.print("Received packet of size "); + Serial.println(packetSize); + Serial.print("From "); + IPAddress remote = Udp.remoteIP(); + for (int i =0; i < 4; i++) + { + Serial.print(remote[i], DEC); + if (i < 3) + { + Serial.print("."); + } + } + Serial.print(", port "); + Serial.println(Udp.remotePort()); + + // read the packet into packetBufffer + Udp.read(packetBuffer,UDP_TX_PACKET_MAX_SIZE); + Serial.println("Contents:"); + Serial.println(packetBuffer); + } +} +``` + +## UDP class + +### `EthernetUDP.stop()` + +#### Description + +Disconnect from the server. Release any resource being used during the UDP session. + + +#### Syntax + +``` +EthernetUDP.stop() + +``` + +#### Parameters +none + +#### Returns +none + +### `UDP.remoteIP()` + +#### Description +Gets the IP address of the remote connection. + +This function must be called after UDP.parsePacket(). + + +#### Syntax + +``` +UDP.remoteIP(); +``` + +#### Parameters +None + +#### Returns +4 bytes : the IP address of the remote connection + +#### Example + +``` + +#include +#include +#include + +// Enter a MAC address and IP address for your controller below. +// The IP address will be dependent on your local network: +byte mac[] = { + 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +IPAddress ip(192, 168, 1, 177); + +unsigned int localPort = 8888; // local port to listen on + +// An EthernetUDP instance to let us send and receive packets over UDP +EthernetUDP Udp; + +void setup() { + // start the Ethernet and UDP: + Ethernet.begin(mac,ip); + Udp.begin(localPort); +} + +void loop() { + + int packetSize = Udp.parsePacket(); + if(packetSize) + { + Serial.print("Received packet of size "); + Serial.println(packetSize); + Serial.print("From IP : "); + + IPAddress remote = Udp.remoteIP(); + //print out the remote connection's IP address + Serial.print(remote); + + Serial.print(" on port : "); + //print out the remote connection's port + Serial.println(Udp.remotePort()); + } + +} + + +``` + +### `UDP.remotePort()` + +#### Description +Gets the port of the remote UDP connection. + +This function must be called after UDP.parsePacket(). + + +#### Syntax + +``` +UDP.remotePort(); +``` + +#### Parameters +None + +#### Returns +int : the port of the UDP connection to a remote host + +#### Example + +``` +#include +#include +#include + +// Enter a MAC address and IP address for your controller below. +// The IP address will be dependent on your local network: +byte mac[] = { + 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; +IPAddress ip(192, 168, 1, 177); + +unsigned int localPort = 8888; // local port to listen on + +// An EthernetUDP instance to let us send and receive packets over UDP +EthernetUDP Udp; + +char packetBuffer[UDP_TX_PACKET_MAX_SIZE]; //buffer to hold incoming packet, + +void setup() { + // start the Ethernet and UDP: + Ethernet.begin(mac,ip); + Udp.begin(localPort); + +} + +void loop() { + + int packetSize = Udp.parsePacket(); + if(packetSize) + { + Serial.print("Received packet of size "); + Serial.println(packetSize); + Serial.print("From "); + IPAddress remote = Udp.remoteIP(); + for (int i =0; i < 4; i++) + { + Serial.print(remote[i], DEC); + if (i < 3) + { + Serial.print("."); + } + } + Serial.print(", port "); + Serial.println(Udp.remotePort()); + + // read the packet into packetBufffer + Udp.read(packetBuffer,UDP_TX_PACKET_MAX_SIZE); + Serial.println("Contents:"); + Serial.println(packetBuffer); + } +} +``` \ No newline at end of file diff --git a/docs/readme.md b/docs/readme.md new file mode 100644 index 00000000..7db6e2f8 --- /dev/null +++ b/docs/readme.md @@ -0,0 +1,11 @@ +# Ethernet Library + +This library is designed to work with the Arduino Ethernet Shield, Arduino Ethernet Shield 2, Leonardo Ethernet, and any other W5100/W5200/W5500-based devices. The library allows an Arduino board to connect to the Internet. The board can serve as either a server accepting incoming connections or a client making outgoing ones. The library supports up to eight (W5100 and boards with <= 2 kB SRAM are limited to four) concurrent connections (incoming, outgoing, or a combination). + +The Arduino board 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 Ethernet controller chip, but it must be kept as an output or the SPI interface won't work. + +``` +To use this library +#include +#include +``` \ No newline at end of file From e8e9026323bb712fe7f80d8a6ddf37d9cf3cd853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karl=20S=C3=B6derby?= <35461661+karlsoderby@users.noreply.github.com> Date: Mon, 4 Oct 2021 17:12:45 +0200 Subject: [PATCH 15/43] Added pinout --- docs/arduino_mega_ethernet_pins.png | Bin 0 -> 19276 bytes docs/arduino_uno_ethernet_pins.png | Bin 0 -> 11418 bytes docs/readme.md | 4 ++++ 3 files changed, 4 insertions(+) create mode 100644 docs/arduino_mega_ethernet_pins.png create mode 100644 docs/arduino_uno_ethernet_pins.png diff --git a/docs/arduino_mega_ethernet_pins.png b/docs/arduino_mega_ethernet_pins.png new file mode 100644 index 0000000000000000000000000000000000000000..e35edc2c8db2ab7ed4aa17b94854931f86ca525d GIT binary patch literal 19276 zcmd?Q)c!<^BP8zVvi;S9Nt)?b>^-y((Vgr2;M%1r`Vd!c|g~)dGPa00;!u#(*G8 zZerh4A`j#~at1!y?sh)@mR`0XDI0eyTR_Rx(%x3f*3u@>bJSK0Sqr40sw3y=>1p+O z1y|oSBG}A8PmZ6TFDUM{VZ@vE{R^DnOy&TDf}SCFS}iv>ch);!aanmiJw20xCVy`O zsD+=fuy9Rru%@P_my7Pw#hqDsdt$V;s;VlZM~t(*CJqixYEikt`w|5!M}=2OqM{<1 zZ(TYTH#9Uf2nh)>MU>LsI0aAdwAMtDJ4L=za-agzoIcG6) zEdDZkc5`Q(*O)%=wXd(Q>HCUWMzxrjn7q7vU|l~P4wsOSkd>7kT-}zImQGqc;N;}w zSJS=kCQ(pO!1sB3c6NptmP0~9A|N1;pPw%yBeTA~PD4ZU#P1zmK-$#Q6uxhYmXjv} zfxr&Q#0t&k3QDf4t8Px4-KXcguX8sn=5POKDCW^Wozwh00H=bt8%jQbNia;`!~*!m3N@~tE*Dh)k5)x!Lu(6AJBPl7-x^+_BJH#j?mNGa^%*5*0 z@l`@XoZCHI!_iG%UW)5YsYPWc7z}o>x0jNV!i47%_`F3<0QjhWG}3xNK3Xrek*EKE z{(-b_p$s69{G5`klup3XNe-q3y?)@H?FVqwDi>oU7qh2_s>Z+uMkIIr0=|nPB>*e4 zmY>GR=%|?~Xei;^0@uzi5l9a!OFP)jTdRvj);51M?OJ$0wt|j=D!|PqC@ipTwM7|h zqwZQ6w04^$(oxBI&E7p}?W;e3RB?FvQ~zh^&);jezpz%?JXxJXA6eHwzkv+AG3J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9183ffb Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 15 Dec 2021 12:09:18 +0100 Subject: [PATCH 16/43] Adding sync-labels workflow for sharing one set of labels across all repos. (#178) --- .github/workflows/sync-labels.yml | 138 ++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 .github/workflows/sync-labels.yml diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml new file mode 100644 index 00000000..fe53570f --- /dev/null +++ b/.github/workflows/sync-labels.yml @@ -0,0 +1,138 @@ +# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/sync-labels.md +name: Sync Labels + +# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows +on: + push: + paths: + - ".github/workflows/sync-labels.ya?ml" + - ".github/label-configuration-files/*.ya?ml" + pull_request: + paths: + - ".github/workflows/sync-labels.ya?ml" + - ".github/label-configuration-files/*.ya?ml" + schedule: + # Run daily at 8 AM UTC to sync with changes to shared label configurations. + - cron: "0 8 * * *" + workflow_dispatch: + repository_dispatch: + +env: + CONFIGURATIONS_FOLDER: .github/label-configuration-files + CONFIGURATIONS_ARTIFACT: label-configuration-files + +jobs: + check: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Download JSON schema for labels configuration file + id: download-schema + uses: carlosperate/download-file-action@v1.0.3 + with: + file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/arduino-tooling-gh-label-configuration-schema.json + location: ${{ runner.temp }}/label-configuration-schema + + - name: Install JSON schema validator + run: | + sudo npm install \ + --global \ + ajv-cli \ + ajv-formats + + - name: Validate local labels configuration + run: | + # See: https://github.com/ajv-validator/ajv-cli#readme + ajv validate \ + --all-errors \ + -c ajv-formats \ + -s "${{ steps.download-schema.outputs.file-path }}" \ + -d "${{ env.CONFIGURATIONS_FOLDER }}/*.{yml,yaml}" + + download: + needs: check + runs-on: ubuntu-latest + + strategy: + matrix: + filename: + # Filenames of the shared configurations to apply to the repository in addition to the local configuration. + # https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/assets/sync-labels + - universal.yml + + steps: + - name: Download + uses: carlosperate/download-file-action@v1.0.3 + with: + file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }} + + - name: Pass configuration files to next job via workflow artifact + uses: actions/upload-artifact@v2 + with: + path: | + *.yaml + *.yml + if-no-files-found: error + name: ${{ env.CONFIGURATIONS_ARTIFACT }} + + sync: + needs: download + runs-on: ubuntu-latest + + steps: + - name: Set environment variables + run: | + # See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable + echo "MERGED_CONFIGURATION_PATH=${{ runner.temp }}/labels.yml" >> "$GITHUB_ENV" + + - name: Determine whether to dry run + id: dry-run + if: > + github.event_name == 'pull_request' || + ( + ( + github.event_name == 'push' || + github.event_name == 'workflow_dispatch' + ) && + github.ref != format('refs/heads/{0}', github.event.repository.default_branch) + ) + run: | + # Use of this flag in the github-label-sync command will cause it to only check the validity of the + # configuration. + echo "::set-output name=flag::--dry-run" + + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Download configuration files artifact + uses: actions/download-artifact@v2 + with: + name: ${{ env.CONFIGURATIONS_ARTIFACT }} + path: ${{ env.CONFIGURATIONS_FOLDER }} + + - name: Remove unneeded artifact + uses: geekyeggo/delete-artifact@v1 + with: + name: ${{ env.CONFIGURATIONS_ARTIFACT }} + + - name: Merge label configuration files + run: | + # Merge all configuration files + shopt -s extglob + cat "${{ env.CONFIGURATIONS_FOLDER }}"/*.@(yml|yaml) > "${{ env.MERGED_CONFIGURATION_PATH }}" + + - name: Install github-label-sync + run: sudo npm install --global github-label-sync + + - name: Sync labels + env: + GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # See: https://github.com/Financial-Times/github-label-sync + github-label-sync \ + --labels "${{ env.MERGED_CONFIGURATION_PATH }}" \ + ${{ steps.dry-run.outputs.flag }} \ + ${{ github.repository }} From 473cfebaa3e480e91850d5a48c5c834e5a4d446d Mon Sep 17 00:00:00 2001 From: fredlcore Date: Wed, 15 Dec 2021 12:11:27 +0100 Subject: [PATCH 17/43] Missing virtual destructor results in compiler warning (#153) When `delete`ing an EthernetClient object, the compiler throws the following warning: `warning: deleting object of polymorphic class type 'EthernetClient' which has non-virtual destructor might cause undefined behavior [-Wdelete-non-virtual-dtor]` Adding a virtual destructor solves this problem, see also here: https://stackoverflow.com/questions/43282826/suppress-delete-non-virtual-dtor-warning-when-using-a-protected-non-virtual-dest --- src/Ethernet.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Ethernet.h b/src/Ethernet.h index 745fa4a3..aef49882 100644 --- a/src/Ethernet.h +++ b/src/Ethernet.h @@ -215,6 +215,7 @@ class EthernetClient : public Client { public: EthernetClient() : sockindex(MAX_SOCK_NUM), _timeout(1000) { } EthernetClient(uint8_t s) : sockindex(s), _timeout(1000) { } + virtual ~EthernetClient() {}; uint8_t status(); virtual int connect(IPAddress ip, uint16_t port); From 1e2a6c22b4a8bbdd8ea4bd17539d136b4d4d5571 Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Sat, 28 Jul 2018 23:46:05 +0200 Subject: [PATCH 18/43] rename sockindex to _sockindex private variable in this class begin with _ --- src/Ethernet.h | 10 ++--- src/EthernetClient.cpp | 94 +++++++++++++++++++++--------------------- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/src/Ethernet.h b/src/Ethernet.h index aef49882..0045de88 100644 --- a/src/Ethernet.h +++ b/src/Ethernet.h @@ -213,8 +213,8 @@ class EthernetUDP : public UDP { class EthernetClient : public Client { public: - EthernetClient() : sockindex(MAX_SOCK_NUM), _timeout(1000) { } - EthernetClient(uint8_t s) : sockindex(s), _timeout(1000) { } + EthernetClient() : _sockindex(MAX_SOCK_NUM), _timeout(1000) { } + EthernetClient(uint8_t s) : _sockindex(s), _timeout(1000) { } virtual ~EthernetClient() {}; uint8_t status(); @@ -230,12 +230,12 @@ class EthernetClient : public Client { virtual void flush(); virtual void stop(); virtual uint8_t connected(); - virtual operator bool() { return sockindex < MAX_SOCK_NUM; } + virtual operator bool() { return _sockindex < MAX_SOCK_NUM; } virtual bool operator==(const bool value) { return bool() == value; } virtual bool operator!=(const bool value) { return bool() != value; } virtual bool operator==(const EthernetClient&); virtual bool operator!=(const EthernetClient& rhs) { return !this->operator==(rhs); } - uint8_t getSocketNumber() const { return sockindex; } + uint8_t getSocketNumber() const { return _sockindex; } virtual uint16_t localPort(); virtual IPAddress remoteIP(); virtual uint16_t remotePort(); @@ -246,7 +246,7 @@ class EthernetClient : public Client { using Print::write; private: - uint8_t sockindex; // MAX_SOCK_NUM means client not in use + uint8_t _sockindex; // MAX_SOCK_NUM means client not in use uint16_t _timeout; }; diff --git a/src/EthernetClient.cpp b/src/EthernetClient.cpp index 9762b56c..5a20c748 100644 --- a/src/EthernetClient.cpp +++ b/src/EthernetClient.cpp @@ -28,11 +28,11 @@ int EthernetClient::connect(const char * host, uint16_t port) DNSClient dns; // Look up the host first IPAddress remote_addr; - if (sockindex < MAX_SOCK_NUM) { - if (Ethernet.socketStatus(sockindex) != SnSR::CLOSED) { - Ethernet.socketDisconnect(sockindex); // TODO: should we call stop()? + if (_sockindex < MAX_SOCK_NUM) { + if (Ethernet.socketStatus(_sockindex) != SnSR::CLOSED) { + Ethernet.socketDisconnect(_sockindex); // TODO: should we call stop()? } - sockindex = MAX_SOCK_NUM; + _sockindex = MAX_SOCK_NUM; } dns.begin(Ethernet.dnsServerIP()); if (!dns.getHostByName(host, remote_addr)) return 0; // TODO: use _timeout @@ -41,38 +41,38 @@ int EthernetClient::connect(const char * host, uint16_t port) int EthernetClient::connect(IPAddress ip, uint16_t port) { - if (sockindex < MAX_SOCK_NUM) { - if (Ethernet.socketStatus(sockindex) != SnSR::CLOSED) { - Ethernet.socketDisconnect(sockindex); // TODO: should we call stop()? + if (_sockindex < MAX_SOCK_NUM) { + if (Ethernet.socketStatus(_sockindex) != SnSR::CLOSED) { + Ethernet.socketDisconnect(_sockindex); // TODO: should we call stop()? } - sockindex = MAX_SOCK_NUM; + _sockindex = MAX_SOCK_NUM; } #if defined(ESP8266) || defined(ESP32) if (ip == IPAddress((uint32_t)0) || ip == IPAddress(0xFFFFFFFFul)) return 0; #else if (ip == IPAddress(0ul) || ip == IPAddress(0xFFFFFFFFul)) return 0; #endif - sockindex = Ethernet.socketBegin(SnMR::TCP, 0); - if (sockindex >= MAX_SOCK_NUM) return 0; - Ethernet.socketConnect(sockindex, rawIPAddress(ip), port); + _sockindex = Ethernet.socketBegin(SnMR::TCP, 0); + if (_sockindex >= MAX_SOCK_NUM) return 0; + Ethernet.socketConnect(_sockindex, rawIPAddress(ip), port); uint32_t start = millis(); while (1) { - uint8_t stat = Ethernet.socketStatus(sockindex); + uint8_t stat = Ethernet.socketStatus(_sockindex); if (stat == SnSR::ESTABLISHED) return 1; if (stat == SnSR::CLOSE_WAIT) return 1; if (stat == SnSR::CLOSED) return 0; if (millis() - start > _timeout) break; delay(1); } - Ethernet.socketClose(sockindex); - sockindex = MAX_SOCK_NUM; + Ethernet.socketClose(_sockindex); + _sockindex = MAX_SOCK_NUM; return 0; } int EthernetClient::availableForWrite(void) { - if (sockindex >= MAX_SOCK_NUM) return 0; - return Ethernet.socketSendAvailable(sockindex); + if (_sockindex >= MAX_SOCK_NUM) return 0; + return Ethernet.socketSendAvailable(_sockindex); } size_t EthernetClient::write(uint8_t b) @@ -82,16 +82,16 @@ size_t EthernetClient::write(uint8_t b) size_t EthernetClient::write(const uint8_t *buf, size_t size) { - if (sockindex >= MAX_SOCK_NUM) return 0; - if (Ethernet.socketSend(sockindex, buf, size)) return size; + if (_sockindex >= MAX_SOCK_NUM) return 0; + if (Ethernet.socketSend(_sockindex, buf, size)) return size; setWriteError(); return 0; } int EthernetClient::available() { - if (sockindex >= MAX_SOCK_NUM) return 0; - return Ethernet.socketRecvAvailable(sockindex); + if (_sockindex >= MAX_SOCK_NUM) return 0; + return Ethernet.socketRecvAvailable(_sockindex); // TODO: do the WIZnet chips automatically retransmit TCP ACK // packets if they are lost by the network? Someday this should // be checked by a man-in-the-middle test which discards certain @@ -102,77 +102,77 @@ int EthernetClient::available() int EthernetClient::read(uint8_t *buf, size_t size) { - if (sockindex >= MAX_SOCK_NUM) return 0; - return Ethernet.socketRecv(sockindex, buf, size); + if (_sockindex >= MAX_SOCK_NUM) return 0; + return Ethernet.socketRecv(_sockindex, buf, size); } int EthernetClient::peek() { - if (sockindex >= MAX_SOCK_NUM) return -1; + if (_sockindex >= MAX_SOCK_NUM) return -1; if (!available()) return -1; - return Ethernet.socketPeek(sockindex); + return Ethernet.socketPeek(_sockindex); } int EthernetClient::read() { uint8_t b; - if (Ethernet.socketRecv(sockindex, &b, 1) > 0) return b; + if (Ethernet.socketRecv(_sockindex, &b, 1) > 0) return b; return -1; } void EthernetClient::flush() { - while (sockindex < MAX_SOCK_NUM) { - uint8_t stat = Ethernet.socketStatus(sockindex); + while (_sockindex < MAX_SOCK_NUM) { + uint8_t stat = Ethernet.socketStatus(_sockindex); if (stat != SnSR::ESTABLISHED && stat != SnSR::CLOSE_WAIT) return; - if (Ethernet.socketSendAvailable(sockindex) >= W5100.SSIZE) return; + if (Ethernet.socketSendAvailable(_sockindex) >= W5100.SSIZE) return; } } void EthernetClient::stop() { - if (sockindex >= MAX_SOCK_NUM) return; + if (_sockindex >= MAX_SOCK_NUM) return; // attempt to close the connection gracefully (send a FIN to other side) - Ethernet.socketDisconnect(sockindex); + Ethernet.socketDisconnect(_sockindex); unsigned long start = millis(); // wait up to a second for the connection to close do { - if (Ethernet.socketStatus(sockindex) == SnSR::CLOSED) { - sockindex = MAX_SOCK_NUM; + if (Ethernet.socketStatus(_sockindex) == SnSR::CLOSED) { + _sockindex = MAX_SOCK_NUM; return; // exit the loop } delay(1); } while (millis() - start < _timeout); // if it hasn't closed, close it forcefully - Ethernet.socketClose(sockindex); - sockindex = MAX_SOCK_NUM; + Ethernet.socketClose(_sockindex); + _sockindex = MAX_SOCK_NUM; } uint8_t EthernetClient::connected() { - if (sockindex >= MAX_SOCK_NUM) return 0; + if (_sockindex >= MAX_SOCK_NUM) return 0; - uint8_t s = Ethernet.socketStatus(sockindex); + uint8_t s = Ethernet.socketStatus(_sockindex); return !(s == SnSR::LISTEN || s == SnSR::CLOSED || s == SnSR::FIN_WAIT || (s == SnSR::CLOSE_WAIT && !available())); } uint8_t EthernetClient::status() { - if (sockindex >= MAX_SOCK_NUM) return SnSR::CLOSED; - return Ethernet.socketStatus(sockindex); + if (_sockindex >= MAX_SOCK_NUM) return SnSR::CLOSED; + return Ethernet.socketStatus(_sockindex); } // the next function allows us to use the client returned by // EthernetServer::available() as the condition in an if-statement. bool EthernetClient::operator==(const EthernetClient& rhs) { - if (sockindex != rhs.sockindex) return false; - if (sockindex >= MAX_SOCK_NUM) return false; - if (rhs.sockindex >= MAX_SOCK_NUM) return false; + if (_sockindex != rhs._sockindex) return false; + if (_sockindex >= MAX_SOCK_NUM) return false; + if (rhs._sockindex >= MAX_SOCK_NUM) return false; return true; } @@ -180,10 +180,10 @@ bool EthernetClient::operator==(const EthernetClient& rhs) // from: https://github.com/ntruchsess/Arduino-1/commit/937bce1a0bb2567f6d03b15df79525569377dabd uint16_t EthernetClient::localPort() { - if (sockindex >= MAX_SOCK_NUM) return 0; + if (_sockindex >= MAX_SOCK_NUM) return 0; uint16_t port; SPI.beginTransaction(SPI_ETHERNET_SETTINGS); - port = W5100.readSnPORT(sockindex); + port = W5100.readSnPORT(_sockindex); SPI.endTransaction(); return port; } @@ -192,10 +192,10 @@ uint16_t EthernetClient::localPort() // returns the remote IP address: https://forum.arduino.cc/index.php?topic=82416.0 IPAddress EthernetClient::remoteIP() { - if (sockindex >= MAX_SOCK_NUM) return IPAddress((uint32_t)0); + if (_sockindex >= MAX_SOCK_NUM) return IPAddress((uint32_t)0); uint8_t remoteIParray[4]; SPI.beginTransaction(SPI_ETHERNET_SETTINGS); - W5100.readSnDIPR(sockindex, remoteIParray); + W5100.readSnDIPR(_sockindex, remoteIParray); SPI.endTransaction(); return IPAddress(remoteIParray); } @@ -204,10 +204,10 @@ IPAddress EthernetClient::remoteIP() // from: https://github.com/ntruchsess/Arduino-1/commit/ca37de4ba4ecbdb941f14ac1fe7dd40f3008af75 uint16_t EthernetClient::remotePort() { - if (sockindex >= MAX_SOCK_NUM) return 0; + if (_sockindex >= MAX_SOCK_NUM) return 0; uint16_t port; SPI.beginTransaction(SPI_ETHERNET_SETTINGS); - port = W5100.readSnDPORT(sockindex); + port = W5100.readSnDPORT(_sockindex); SPI.endTransaction(); return port; } From 6a5b8be9f2f4d84f1172ef2268ba294af8d4f0da Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 15 Dec 2021 13:15:05 +0100 Subject: [PATCH 19/43] Fixing spelling error within examples/PagerServer. (#179) --- examples/PagerServer/PagerServer.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/PagerServer/PagerServer.ino b/examples/PagerServer/PagerServer.ino index d1b202ce..e0463c18 100644 --- a/examples/PagerServer/PagerServer.ino +++ b/examples/PagerServer/PagerServer.ino @@ -39,7 +39,7 @@ void setup() { if (Ethernet.linkStatus() == LinkOFF) { Serial.println("Ethernet cable is not connected."); } - // try to congifure using IP address instead of DHCP: + // try to configure using IP address instead of DHCP: Ethernet.begin(mac, ip); } else { Serial.print(" DHCP assigned IP "); From d7b8b6055d2a42c5878ca0230e6acb4d734afe63 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 15 Dec 2021 13:26:32 +0100 Subject: [PATCH 20/43] Fixing CI build for Arduino SAM Due. (#180) The class EthernetServer, derived from Server, derived from Print does not contain a 'flush' method as for all other cores. --- examples/PagerServer/PagerServer.ino | 2 ++ 1 file changed, 2 insertions(+) diff --git a/examples/PagerServer/PagerServer.ino b/examples/PagerServer/PagerServer.ino index e0463c18..929ede55 100644 --- a/examples/PagerServer/PagerServer.ino +++ b/examples/PagerServer/PagerServer.ino @@ -64,6 +64,8 @@ void loop() { Serial.println(s); // print the message to Serial Monitor client.print("echo: "); // this is only for the sending client server.println(s); // send the message to all connected clients +#ifndef ARDUINO_ARCH_SAM server.flush(); // flush the buffers +#endif /* !defined(ARDUINO_ARCH_SAM) */ } } From e7d6c6d9d591f6678ada84aee190148cd496b797 Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Tue, 14 Feb 2017 19:24:08 +0100 Subject: [PATCH 21/43] same mac for all examples --- examples/DhcpAddressPrinter/DhcpAddressPrinter.ino | 2 +- examples/DhcpChatServer/DhcpChatServer.ino | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino b/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino index 4a61bd08..612106f9 100644 --- a/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino +++ b/examples/DhcpAddressPrinter/DhcpAddressPrinter.ino @@ -22,7 +22,7 @@ // Enter a MAC address for your controller below. // Newer Ethernet shields have a MAC address printed on a sticker on the shield byte mac[] = { - 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 + 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; void setup() { diff --git a/examples/DhcpChatServer/DhcpChatServer.ino b/examples/DhcpChatServer/DhcpChatServer.ino index 28e2431a..e3b5d411 100644 --- a/examples/DhcpChatServer/DhcpChatServer.ino +++ b/examples/DhcpChatServer/DhcpChatServer.ino @@ -27,7 +27,7 @@ // The IP address will be dependent on your local network. // gateway and subnet are optional: byte mac[] = { - 0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02 + 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; IPAddress ip(192, 168, 1, 177); IPAddress myDns(192, 168, 1, 1); From 993eea87da7f6716b0c2b2be848476670a2fab8c Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 20 Dec 2021 05:07:20 -0800 Subject: [PATCH 22/43] Use major version ref of `carlosperate/download-file-action` (#181) The `carlosperate/download-file-action` action is used in the GitHub Actions workflows as a convenient way to download external resources. A major version ref has been added to that repository. It will always point to the latest release of the "1" major version series. This means it is no longer necessary to do a full pin of the action version in use as before. Use of the major version ref will cause the workflow to use a stable version of the action, while also benefiting from ongoing development to the action up until such time as a new major release of an action is made. At that time we would need to evaluate whether any changes to the workflow are required by the breaking change that triggered the major release before manually updating the major ref (e.g., uses: `carlosperate/download-file-action@v2`). I think this approach strikes the right balance between stability and maintainability for these workflows. --- .github/workflows/sync-labels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index fe53570f..3ee6febd 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -31,7 +31,7 @@ jobs: - name: Download JSON schema for labels configuration file id: download-schema - uses: carlosperate/download-file-action@v1.0.3 + uses: carlosperate/download-file-action@v1 with: file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/arduino-tooling-gh-label-configuration-schema.json location: ${{ runner.temp }}/label-configuration-schema @@ -65,7 +65,7 @@ jobs: steps: - name: Download - uses: carlosperate/download-file-action@v1.0.3 + uses: carlosperate/download-file-action@v1 with: file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }} From 56ab3e934e7db53f5a4d7d186d84967b579d0095 Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 21 Feb 2022 20:19:28 -0800 Subject: [PATCH 23/43] Standardize format of example sketch titles --- .../BarometricPressureWebServer.ino | 2 +- examples/DhcpChatServer/DhcpChatServer.ino | 2 +- examples/LinkStatus/LinkStatus.ino | 1 + examples/PagerServer/PagerServer.ino | 2 +- examples/TelnetClient/TelnetClient.ino | 2 +- examples/UDPSendReceiveString/UDPSendReceiveString.ino | 3 ++- examples/UdpNtpClient/UdpNtpClient.ino | 1 - examples/WebClient/WebClient.ino | 2 +- examples/WebClientRepeating/WebClientRepeating.ino | 2 +- examples/WebServer/WebServer.ino | 2 +- 10 files changed, 10 insertions(+), 9 deletions(-) diff --git a/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino b/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino index cc1325b2..b397b43b 100644 --- a/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino +++ b/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino @@ -1,5 +1,5 @@ /* - SCP1000 Barometric Pressure Sensor Display + SCP1000 Barometric Pressure Sensor Display Serves the output of a Barometric Pressure Sensor as a web page. Uses the SPI library. For details on the sensor, see: diff --git a/examples/DhcpChatServer/DhcpChatServer.ino b/examples/DhcpChatServer/DhcpChatServer.ino index e3b5d411..01cd8140 100644 --- a/examples/DhcpChatServer/DhcpChatServer.ino +++ b/examples/DhcpChatServer/DhcpChatServer.ino @@ -1,5 +1,5 @@ /* - DHCP Chat Server + DHCP Chat Server A simple server that distributes any incoming messages to all connected clients. To use, telnet to your device's IP address and type. diff --git a/examples/LinkStatus/LinkStatus.ino b/examples/LinkStatus/LinkStatus.ino index 54654dad..84651d09 100644 --- a/examples/LinkStatus/LinkStatus.ino +++ b/examples/LinkStatus/LinkStatus.ino @@ -1,5 +1,6 @@ /* Link Status + This sketch prints the Ethernet link status. When the Ethernet cable is connected the link status should go to "ON". NOTE: Only WIZnet W5200 and W5500 are capable of reporting diff --git a/examples/PagerServer/PagerServer.ino b/examples/PagerServer/PagerServer.ino index 929ede55..e17ae6ed 100644 --- a/examples/PagerServer/PagerServer.ino +++ b/examples/PagerServer/PagerServer.ino @@ -1,5 +1,5 @@ /* - Pager Server + Pager Server A simple server that echoes any incoming messages to all connected clients. Connect two or more telnet sessions diff --git a/examples/TelnetClient/TelnetClient.ino b/examples/TelnetClient/TelnetClient.ino index 42748bf8..ff554a5c 100644 --- a/examples/TelnetClient/TelnetClient.ino +++ b/examples/TelnetClient/TelnetClient.ino @@ -1,5 +1,5 @@ /* - Telnet client + Telnet client This sketch connects to a telnet server (http://www.google.com) using an Arduino WIZnet Ethernet shield. You'll need a telnet server diff --git a/examples/UDPSendReceiveString/UDPSendReceiveString.ino b/examples/UDPSendReceiveString/UDPSendReceiveString.ino index 2a693ff4..21f97cab 100644 --- a/examples/UDPSendReceiveString/UDPSendReceiveString.ino +++ b/examples/UDPSendReceiveString/UDPSendReceiveString.ino @@ -1,5 +1,6 @@ /* - UDPSendReceiveString: + UDPSendReceiveString + This sketch receives UDP message strings, prints them to the serial port and sends an "acknowledge" string back to the sender diff --git a/examples/UdpNtpClient/UdpNtpClient.ino b/examples/UdpNtpClient/UdpNtpClient.ino index dd801dc8..1455b40d 100644 --- a/examples/UdpNtpClient/UdpNtpClient.ino +++ b/examples/UdpNtpClient/UdpNtpClient.ino @@ -1,5 +1,4 @@ /* - Udp NTP Client Get the time from a Network Time Protocol (NTP) time server diff --git a/examples/WebClient/WebClient.ino b/examples/WebClient/WebClient.ino index 9e882292..f4a5d02a 100644 --- a/examples/WebClient/WebClient.ino +++ b/examples/WebClient/WebClient.ino @@ -1,5 +1,5 @@ /* - Web client + Web client This sketch connects to a website (http://www.google.com) using an Arduino WIZnet Ethernet shield. diff --git a/examples/WebClientRepeating/WebClientRepeating.ino b/examples/WebClientRepeating/WebClientRepeating.ino index ab3cc407..d0ec2238 100644 --- a/examples/WebClientRepeating/WebClientRepeating.ino +++ b/examples/WebClientRepeating/WebClientRepeating.ino @@ -1,5 +1,5 @@ /* - Repeating Web client + Repeating Web client This sketch connects to a a web server and makes a request using a WIZnet Ethernet shield. You can use the Arduino Ethernet Shield, or diff --git a/examples/WebServer/WebServer.ino b/examples/WebServer/WebServer.ino index f5593c73..f3929d2d 100644 --- a/examples/WebServer/WebServer.ino +++ b/examples/WebServer/WebServer.ino @@ -1,5 +1,5 @@ /* - Web Server + Web Server A simple web server that shows the value of the analog input pins. using an Arduino WIZnet Ethernet shield. From 6f0c5932f4fb1575e23d02a1db1df1972b082f48 Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 21 Feb 2022 20:20:38 -0800 Subject: [PATCH 24/43] Correct typos in documentation --- docs/api.md | 8 ++++---- docs/readme.md | 3 ++- .../BarometricPressureWebServer.ino | 2 +- examples/UDPSendReceiveString/UDPSendReceiveString.ino | 2 +- examples/WebClientRepeating/WebClientRepeating.ino | 4 ++-- library.properties | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/api.md b/docs/api.md index 9bc815d8..4cb32dc7 100644 --- a/docs/api.md +++ b/docs/api.md @@ -6,7 +6,7 @@ #### Description -Initializes the ethernet library and network settings. +Initializes the Ethernet library and network settings. With version 1.0, the library supports DHCP. Using Ethernet.begin(mac) with the proper network setup, the Ethernet shield will automatically obtain an IP address. This increases the sketch size significantly. To make sure the DHCP lease is properly renewed when needed, be sure to call Ethernet.maintain() regularly. @@ -2107,7 +2107,7 @@ void loop() { Serial.print(", port "); Serial.println(Udp.remotePort()); - // read the packet into packetBufffer + // read the packet into packetBuffer Udp.read(packetBuffer,UDP_TX_PACKET_MAX_SIZE); Serial.println("Contents:"); Serial.println(packetBuffer); @@ -2432,7 +2432,7 @@ void loop() { Serial.print(", port "); Serial.println(Udp.remotePort()); - // read the packet into packetBufffer + // read the packet into packetBuffer Udp.read(packetBuffer,UDP_TX_PACKET_MAX_SIZE); Serial.println("Contents:"); Serial.println(packetBuffer); @@ -2597,7 +2597,7 @@ void loop() { Serial.print(", port "); Serial.println(Udp.remotePort()); - // read the packet into packetBufffer + // read the packet into packetBuffer Udp.read(packetBuffer,UDP_TX_PACKET_MAX_SIZE); Serial.println("Contents:"); Serial.println(packetBuffer); diff --git a/docs/readme.md b/docs/readme.md index 6798a3e3..cdb2044c 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -8,8 +8,9 @@ The Arduino board communicates with the shield using the SPI bus. This is on dig ![Arduino MEGA Pin map.](./arduino_mega_ethernet_pins.png) -``` To use this library + +``` #include #include ``` \ No newline at end of file diff --git a/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino b/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino index b397b43b..831f17fc 100644 --- a/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino +++ b/examples/BarometricPressureWebServer/BarometricPressureWebServer.ino @@ -216,7 +216,7 @@ void writeRegister(byte registerName, byte registerValue) { //Read register from the SCP1000: unsigned int readRegister(byte registerName, int numBytes) { - byte inByte = 0; // incoming from the SPI read + byte inByte = 0; // incoming from the SPI read unsigned int result = 0; // result to return // SCP1000 expects the register name in the upper 6 bits diff --git a/examples/UDPSendReceiveString/UDPSendReceiveString.ino b/examples/UDPSendReceiveString/UDPSendReceiveString.ino index 21f97cab..3995b331 100644 --- a/examples/UDPSendReceiveString/UDPSendReceiveString.ino +++ b/examples/UDPSendReceiveString/UDPSendReceiveString.ino @@ -83,7 +83,7 @@ void loop() { Serial.print(", port "); Serial.println(Udp.remotePort()); - // read the packet into packetBufffer + // read the packet into packetBuffer Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE); Serial.println("Contents:"); Serial.println(packetBuffer); diff --git a/examples/WebClientRepeating/WebClientRepeating.ino b/examples/WebClientRepeating/WebClientRepeating.ino index d0ec2238..1fb11e10 100644 --- a/examples/WebClientRepeating/WebClientRepeating.ino +++ b/examples/WebClientRepeating/WebClientRepeating.ino @@ -1,7 +1,7 @@ /* Repeating Web client - This sketch connects to a a web server and makes a request + This sketch connects to a web server and makes a request using a WIZnet Ethernet shield. You can use the Arduino Ethernet Shield, or the Adafruit Ethernet shield, either one will work, as long as it's got a WIZnet Ethernet module on board. @@ -104,7 +104,7 @@ void loop() { // this method makes a HTTP connection to the server: void httpRequest() { // close any connection before send a new request. - // This will free the socket on the WiFi shield + // This will free the socket on the Ethernet shield client.stop(); // if there's a successful connection: diff --git a/library.properties b/library.properties index dfb280bf..bcb5c4cf 100644 --- a/library.properties +++ b/library.properties @@ -3,7 +3,7 @@ version=2.0.0 author=Various (see AUTHORS file for details) maintainer=Paul Stoffregen , Arduino sentence=Enables network connection (local and Internet) using the Arduino Ethernet Board or Shield. -paragraph=With this library you can use the Arduino Ethernet (shield or board) to connect to Internet. The library provides both Client and server functionalities. The library permits you to connect to a local network also with DHCP and to resolve DNS. +paragraph=With this library you can use the Arduino Ethernet (shield or board) to connect to Internet. The library provides both client and server functionalities. The library permits you to connect to a local network also with DHCP and to resolve DNS. category=Communication url=https://www.arduino.cc/en/Reference/Ethernet architectures=* From 3e00b4f9c9dabffd33456ebdc57d4ab77bdc0ad8 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Mar 2022 15:16:45 +0000 Subject: [PATCH 25/43] Bump actions/checkout from 2 to 3 Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/check-arduino.yml | 2 +- .github/workflows/compile-examples.yml | 2 +- .github/workflows/spell-check.yml | 2 +- .github/workflows/sync-labels.yml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check-arduino.yml b/.github/workflows/check-arduino.yml index 0d969f6c..3e0d26c9 100644 --- a/.github/workflows/check-arduino.yml +++ b/.github/workflows/check-arduino.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Arduino Lint uses: arduino/arduino-lint-action@v1 diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index c79085da..64f7dd3f 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -85,7 +85,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Compile examples uses: arduino/compile-sketches@v1 diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml index 01bee879..3f6b03fb 100644 --- a/.github/workflows/spell-check.yml +++ b/.github/workflows/spell-check.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Spell check uses: codespell-project/actions-codespell@master diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 3ee6febd..4ea57559 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -27,7 +27,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Download JSON schema for labels configuration file id: download-schema @@ -105,7 +105,7 @@ jobs: echo "::set-output name=flag::--dry-run" - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Download configuration files artifact uses: actions/download-artifact@v2 From e31c453c5d7a9634b4f868f5f98508931e28ea9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Hyl=C3=A9n?= <60390259+jacobhylen@users.noreply.github.com> Date: Fri, 1 Apr 2022 10:35:04 +0200 Subject: [PATCH 26/43] Update api.md --- docs/api.md | 70 ++++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/docs/api.md b/docs/api.md index 4cb32dc7..f132bf55 100644 --- a/docs/api.md +++ b/docs/api.md @@ -872,7 +872,7 @@ void loop() } ``` -### `begin()` +### `server.begin()` #### Description @@ -931,7 +931,7 @@ void loop() } ``` -### `accept()` +### `server.accept()` #### Description @@ -1015,7 +1015,7 @@ void loop() { } ``` -### `available()` +### `server.available()` #### Description @@ -1130,7 +1130,7 @@ void loop() { } ``` -### `write()` +### `server.write()` #### Description @@ -1197,7 +1197,7 @@ void loop() } ``` -### `print()` +### `server.print()` #### Description @@ -1222,7 +1222,7 @@ byte print() will return the number of bytes written, though reading that number is optional -### `println()` +### `server.println()` #### Description @@ -1390,7 +1390,7 @@ void loop() ``` -### `connected()` +### `client.connected()` #### Description @@ -1457,7 +1457,7 @@ void loop() } ``` -### `connect()` +### `client.connect()` #### Description @@ -1535,7 +1535,7 @@ void loop() } ``` -### `localPort()` +### `client.localPort()` #### Description @@ -1592,7 +1592,7 @@ void loop() { } ``` -### `remoteIP()` +### `client.remoteIP()` #### Description @@ -1649,7 +1649,7 @@ void loop() { } ``` -### `remotePort()` +### `client.remotePort()` #### Description @@ -1706,7 +1706,7 @@ void loop() { } ``` -### `setConnectionTimeout()` +### `client.setConnectionTimeout()` #### Description @@ -1761,7 +1761,7 @@ void loop() { } ``` -### `write()` +### `client.write()` #### Description @@ -1809,7 +1809,7 @@ BASE (optional): the base in which to print numbers: DEC for decimal (base 10), #### Returns byte: returns the number of bytes written, though reading that number is optional -### `println()` +### `client.println()` #### Description @@ -1834,7 +1834,7 @@ BASE (optional): the base in which to print numbers: DEC for decimal (base 10), byte: return the number of bytes written, though reading that number is optional -### `available()` +### `client.available()` #### Description @@ -1903,7 +1903,7 @@ void loop() } ``` -### `read()` +### `client.read()` #### Description @@ -1944,7 +1944,7 @@ none #### Returns none -### `stop()` +### `client.stop()` #### Description @@ -1964,9 +1964,9 @@ none #### Returns none -# EthernetUDP Class +## EthernetUDP Class -### `UDP.begin()` +### `EthernetUDP.begin()` #### Description Initializes the ethernet UDP library and network settings. @@ -2038,7 +2038,7 @@ void loop() { ``` -### `UDP.read()` +### `EthernetUDP.read()` #### Description Reads UDP data from the specified buffer. If no arguments are given, it will return the next character in the buffer. @@ -2049,8 +2049,8 @@ This function can only be successfully called after UDP.parsePacket(). #### Syntax ``` -UDP.read(); -UDP.read(packetBuffer, MaxSize); +EthernetUDP.read(); +EthernetUDP.read(packetBuffer, MaxSize); ``` #### Parameters @@ -2115,7 +2115,7 @@ void loop() { } ``` -### `UDP.write()` +### `EthernetUDP.write()` #### Description Writes UDP data to the remote connection. Must be wrapped between beginPacket() and endPacket(). beginPacket() initializes the packet of data, it is not sent until endPacket() is called. @@ -2124,8 +2124,8 @@ Writes UDP data to the remote connection. Must be wrapped between beginPacket() #### Syntax ``` -UDP.write(message); -UDP.write(buffer, size); +EthernetUDP.write(message); +EthernetUDP.write(buffer, size); ``` @@ -2199,7 +2199,7 @@ void loop() { ``` -### `UDP.beginPacket()` +### `EthernetUDP.beginPacket()` #### Description Starts a connection to write UDP data to the remote connection @@ -2208,7 +2208,7 @@ Starts a connection to write UDP data to the remote connection #### Syntax ``` -UDP.beginPacket(remoteIP, remotePort); +EthernetUDP.beginPacket(remoteIP, remotePort); ``` #### Parameters @@ -2251,7 +2251,7 @@ void loop() { } ``` -### `UDP.endPacket()` +### `EthernetUDP.endPacket()` #### Description Called after writing UDP data to the remote connection. @@ -2260,7 +2260,7 @@ Called after writing UDP data to the remote connection. #### Syntax ``` -UDP.endPacket(); +EthernetUDP.endPacket(); ``` #### Parameters @@ -2303,7 +2303,7 @@ void loop() { } ``` -### `UDP.parsePacket()` +### `EthernetUDP.parsePacket()` #### Description Checks for the presence of a UDP packet, and reports the size. parsePacket() must be called before reading the buffer with UDP.read(). @@ -2312,7 +2312,7 @@ Checks for the presence of a UDP packet, and reports the size. parsePacket() mus #### Syntax ``` -UDP.parsePacket(); +EthernetUDP.parsePacket(); ``` #### Parameters @@ -2361,7 +2361,7 @@ void loop() { } ``` -### `UDP.available()` +### `EthernetUDP.available()` #### Description @@ -2375,7 +2375,7 @@ available() inherits from the Stream utility class. #### Syntax ``` -UDP.available() +EthernetUDP.available() ``` @@ -2442,7 +2442,7 @@ void loop() { ## UDP class -### `EthernetUDP.stop()` +### `UDP.stop()` #### Description @@ -2452,7 +2452,7 @@ Disconnect from the server. Release any resource being used during the UDP sessi #### Syntax ``` -EthernetUDP.stop() +UDP.stop() ``` From e5240c70c1635301edb56d1cf47d17d392650019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Hyl=C3=A9n?= <60390259+jacobhylen@users.noreply.github.com> Date: Fri, 1 Apr 2022 13:22:07 +0200 Subject: [PATCH 27/43] Update api.md --- docs/api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api.md b/docs/api.md index f132bf55..cb209db4 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1925,7 +1925,7 @@ none #### Returns The next byte (or character), or -1 if none is available. -flush() +client.flush() Waits until all outgoing characters in buffer have been sent. flush() inherits from the Stream utility class. From 2998f47ddf2caa3ff6e917be279d36fb7698efe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20Hyl=C3=A9n?= <60390259+jacobhylen@users.noreply.github.com> Date: Fri, 1 Apr 2022 13:28:13 +0200 Subject: [PATCH 28/43] Update api.md --- docs/api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api.md b/docs/api.md index cb209db4..d72a67d4 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1925,7 +1925,7 @@ none #### Returns The next byte (or character), or -1 if none is available. -client.flush() +### `client.flush()` Waits until all outgoing characters in buffer have been sent. flush() inherits from the Stream utility class. From be90b7dc684e90be41bb531bd030be9dced3c3eb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Apr 2022 15:10:50 +0000 Subject: [PATCH 29/43] Bump actions/upload-artifact from 2 to 3 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/compile-examples.yml | 2 +- .github/workflows/sync-labels.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 64f7dd3f..1e73ea3e 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -104,7 +104,7 @@ jobs: sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} - name: Save sketches report as workflow artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: if-no-files-found: error path: ${{ env.SKETCHES_REPORTS_PATH }} diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 4ea57559..1d969d57 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -70,7 +70,7 @@ jobs: file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }} - name: Pass configuration files to next job via workflow artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: path: | *.yaml From 058a40ace8e513897fdc17b09beaaca10499baef Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 8 Apr 2022 15:10:53 +0000 Subject: [PATCH 30/43] Bump actions/download-artifact from 2 to 3 Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 2 to 3. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v2...v3) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/sync-labels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 4ea57559..e84e803e 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -108,7 +108,7 @@ jobs: uses: actions/checkout@v3 - name: Download configuration files artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: ${{ env.CONFIGURATIONS_ARTIFACT }} path: ${{ env.CONFIGURATIONS_FOLDER }} From c14f3f8a1d92a27775f6ef053ef0c432fb43ece8 Mon Sep 17 00:00:00 2001 From: Hannes7eicher Date: Fri, 29 Apr 2022 11:49:37 +0200 Subject: [PATCH 31/43] Update api.md Fix: Adding missing Bullet Points to Parameters and Returns --- docs/api.md | 171 ++++++++++++++++++++++++++-------------------------- 1 file changed, 86 insertions(+), 85 deletions(-) diff --git a/docs/api.md b/docs/api.md index d72a67d4..76265c82 100644 --- a/docs/api.md +++ b/docs/api.md @@ -29,7 +29,8 @@ Ethernet.begin(mac, ip, dns, gateway, subnet); - subnet: the subnet mask of the network (array of 4 bytes). optional: defaults to 255.255.255.0 #### Returns -The DHCP version of this function, Ethernet.begin(mac), returns an int: 1 on a successful DHCP connection, 0 on failure. The other versions don't return anything. +- The DHCP version of this function, Ethernet.begin(mac), returns an int: 1 on a successful DHCP connection, 0 on failure. +- The other versions don't return anything. #### Example @@ -68,7 +69,7 @@ Ethernet.dnsServerIP() none #### Returns -the DNS server IP address for the device (IPAddress). +- the DNS server IP address for the device (IPAddress). #### Example @@ -112,7 +113,7 @@ Ethernet.gatewayIP() none #### Returns -the gateway IP address for the device (IPAddress). +- the gateway IP address for the device (IPAddress). #### Example @@ -156,7 +157,7 @@ Ethernet.hardwareStatus() none #### Returns -which WIZnet Ethernet controller chip was detected during Ethernet.begin() (EthernetHardwareStatus): +- which WIZnet Ethernet controller chip was detected during Ethernet.begin() (EthernetHardwareStatus): ``` EthernetNoHardware @@ -215,7 +216,7 @@ Ethernet.init(sspin) ``` #### Parameters -sspin: the pin number to use for CS (byte) +- sspin: the pin number to use for CS (byte) #### Returns Nothing @@ -255,13 +256,13 @@ Ethernet.linkStatus() none #### Returns -the link status (EthernetLinkStatus): +- the link status (EthernetLinkStatus): -Unknown +- Unknown -LinkON +- LinkON -LinkOFF +- LinkOFF #### Example @@ -308,7 +309,7 @@ Ethernet.localIP(); none #### Returns -the IP address +- the IP address #### Example @@ -361,7 +362,7 @@ Ethernet.MACAddress(mac_address) ``` #### Parameters -mac_address: buffer to receive the MAC address (array of 6 bytes) +- mac_address: buffer to receive the MAC address (array of 6 bytes) #### Returns Nothing @@ -423,15 +424,15 @@ none byte: -0: nothing happened +- 0: nothing happened -1: renew failed +- 1: renew failed -2: renew success +- 2: renew success -3: rebind fail +- 3: rebind fail -4: rebind success +- 4: rebind success ### `Ethernet.setDnsServerIP()` @@ -448,7 +449,7 @@ Ethernet.setDnsServerIP(dns_server) ``` #### Parameters -dns_server: the IP address of the DNS server (IPAddress) +- dns_server: the IP address of the DNS server (IPAddress) #### Returns Nothing @@ -487,7 +488,7 @@ Ethernet.setGatewayIP(gateway) ``` #### Parameters -gateway: the IP address of the network gateway (IPAddress) +- gateway: the IP address of the network gateway (IPAddress) #### Returns Nothing @@ -527,7 +528,7 @@ Ethernet.setLocalIP(local_ip) ``` #### Parameters -local_ip: the IP address to use (IPAddress) +- local_ip: the IP address to use (IPAddress) #### Returns Nothing @@ -565,7 +566,7 @@ Ethernet.setMACAddress(mac) ``` #### Parameters -mac: the MAC address to use (array of 6 bytes) +- mac: the MAC address to use (array of 6 bytes) #### Returns Nothing @@ -603,7 +604,7 @@ Ethernet.setRetransmissionCount(number) ``` #### Parameters -number: number of transmission attempts the Ethernet controller should make before giving up (byte) +- number: number of transmission attempts the Ethernet controller should make before giving up (byte) #### Returns Nothing @@ -640,7 +641,7 @@ Ethernet.setRetransmissionTimeout(milliseconds) ``` #### Parameters -milliseconds: the timeout duration (uint16_t) +- milliseconds: the timeout duration (uint16_t) #### Returns Nothing @@ -677,7 +678,7 @@ Ethernet.setSubnetMask(subnet) ``` #### Parameters -subnet: the subnet mask of the network (IPAddress) +- subnet: the subnet mask of the network (IPAddress) #### Returns Nothing @@ -721,7 +722,7 @@ Ethernet.subnetMask() none #### Returns -the subnet mask of the device (IPAddress) +- the subnet mask of the device (IPAddress) #### Example @@ -764,7 +765,7 @@ IPAddress(address); ``` #### Parameters -address: a comma delimited list representing the address (4 bytes, ex. 192, 168, 1, 1) +- address: a comma delimited list representing the address (4 bytes, ex. 192, 168, 1, 1) #### Returns None @@ -826,7 +827,7 @@ Server(port); ``` #### Parameters -port: the port to listen on (int) +- port: the port to listen on (int) #### Returns None @@ -953,7 +954,7 @@ server.accept() none #### Returns -a Client object. If no client has data available for reading, this object will evaluate to false in an if-statement. (EthernetClient). +- a Client object. If no client has data available for reading, this object will evaluate to false in an if-statement. (EthernetClient). #### Example @@ -1033,7 +1034,7 @@ server.available() None #### Returns -a Client object; if no Client has data available for reading, this object will evaluate to false in an if-statement (see the example below) +- a Client object; if no Client has data available for reading, this object will evaluate to false in an if-statement (see the example below) #### Example @@ -1092,7 +1093,7 @@ if(server) none #### Returns -whether the server is listening for new clients (bool). +- whether the server is listening for new clients (bool). #### Example @@ -1146,15 +1147,15 @@ server.write(buf, len) ``` #### Parameters -val: a value to send as a single byte (byte or char) +- val: a value to send as a single byte (byte or char) -buf: an array to send as a series of bytes (byte or char) +- buf: an array to send as a series of bytes (byte or char) -len: the length of the buffer +- len: the length of the buffer #### Returns -byte -write() returns the number of bytes written. It is not necessary to read this. +- byte +- write() returns the number of bytes written. It is not necessary to read this. #### Example @@ -1213,13 +1214,13 @@ server.print(data, BASE) ``` #### Parameters -data: the data to print (char, byte, int, long, or string) +- data: the data to print (char, byte, int, long, or string) -BASE (optional): the base in which to print numbers: BIN for binary (base 2), DEC for decimal (base 10), OCT for octal (base 8), HEX for hexadecimal (base 16). +- BASE (optional): the base in which to print numbers: BIN for binary (base 2), DEC for decimal (base 10), OCT for octal (base 8), HEX for hexadecimal (base 16). #### Returns -byte -print() will return the number of bytes written, though reading that number is optional +- byte +- print() will return the number of bytes written, though reading that number is optional ### `server.println()` @@ -1239,14 +1240,14 @@ server.println(data, BASE) ``` #### Parameters -data (optional): the data to print (char, byte, int, long, or string) +- data (optional): the data to print (char, byte, int, long, or string) -BASE (optional): the base in which to print numbers: BIN for binary (base 2), DEC for decimal (base 10), OCT for octal (base 8), HEX for hexadecimal (base 16). +- BASE (optional): the base in which to print numbers: BIN for binary (base 2), DEC for decimal (base 10), OCT for octal (base 8), HEX for hexadecimal (base 16). #### Returns -byte +- byte -println() will return the number of bytes written, though reading that number is optional +- println() will return the number of bytes written, though reading that number is optional ## Client Class @@ -1337,7 +1338,7 @@ if (client) none #### Returns -boolean : returns true if the specified client is available. +- boolean : returns true if the specified client is available. #### Example @@ -1408,7 +1409,7 @@ client.connected() none #### Returns -Returns true if the client is connected, false if not. +- Returns true if the client is connected, false if not. #### Example @@ -1474,20 +1475,20 @@ client.connect(URL, port) ``` #### Parameters -ip: the IP address that the client will connect to (array of 4 bytes) +- ip: the IP address that the client will connect to (array of 4 bytes) -URL: the domain name the client will connect to (string, ex.:"arduino.cc") +- URL: the domain name the client will connect to (string, ex.:"arduino.cc") -port: the port that the client will connect to (int) +- port: the port that the client will connect to (int) #### Returns -Returns an int (1,-1,-2,-3,-4) indicating connection status : +- Returns an int (1,-1,-2,-3,-4) indicating connection status : -SUCCESS 1 -TIMED_OUT -1 -INVALID_SERVER -2 -TRUNCATED -3 -INVALID_RESPONSE -4 +- SUCCESS 1 +- TIMED_OUT -1 +- INVALID_SERVER -2 +- TRUNCATED -3 +- INVALID_RESPONSE -4 #### Example ``` @@ -1553,7 +1554,7 @@ client.localPort none #### Returns -the local port number the client is connected to (uint16_t). +- the local port number the client is connected to (uint16_t). #### Example @@ -1610,7 +1611,7 @@ client.remoteIP() none #### Returns -the client's IP address (IPAddress). +- the client's IP address (IPAddress). #### Example @@ -1667,7 +1668,7 @@ client.remotePort() none #### Returns -the port of the host that sent the current incoming packet (uint16_t). +- the port of the host that sent the current incoming packet (uint16_t). #### Example @@ -1721,7 +1722,7 @@ client.setConnectionTimeout(milliseconds) ``` #### Parameters -milliseconds: the timeout duration for client.connect() and client.stop() (uint16_t) +- milliseconds: the timeout duration for client.connect() and client.stop() (uint16_t) #### Returns Nothing @@ -1777,15 +1778,15 @@ client.write(buf, len) ``` #### Parameters -val: a value to send as a single byte (byte or char) +- val: a value to send as a single byte (byte or char) -buf: an array to send as a series of bytes (byte or char) +- buf: an array to send as a series of bytes (byte or char) -len: the length of the buffer +- len: the length of the buffer #### Returns -byte -write() returns the number of bytes written. It is not necessary to read this value. +byte: +- write() returns the number of bytes written. It is not necessary to read this value. ### `print()` @@ -1803,11 +1804,11 @@ client.print(data, BASE) ``` #### Parameters -data: the data to print (char, byte, int, long, or string) +- data: the data to print (char, byte, int, long, or string) -BASE (optional): the base in which to print numbers: DEC for decimal (base 10), OCT for octal (base 8), HEX for hexadecimal (base 16). +- BASE (optional): the base in which to print numbers: DEC for decimal (base 10), OCT for octal (base 8), HEX for hexadecimal (base 16). #### Returns -byte: returns the number of bytes written, though reading that number is optional +- byte: returns the number of bytes written, though reading that number is optional ### `client.println()` @@ -1826,12 +1827,12 @@ client.print(data, BASE) ``` #### Parameters -data (optional): the data to print (char, byte, int, long, or string) +- data (optional): the data to print (char, byte, int, long, or string) -BASE (optional): the base in which to print numbers: DEC for decimal (base 10), OCT for octal (base 8), HEX for hexadecimal (base 16). +- BASE (optional): the base in which to print numbers: DEC for decimal (base 10), OCT for octal (base 8), HEX for hexadecimal (base 16). #### Returns -byte: return the number of bytes written, though reading that number is optional +- byte: return the number of bytes written, though reading that number is optional ### `client.available()` @@ -1854,7 +1855,7 @@ client.available() none #### Returns -The number of bytes available. +- The number of bytes available. #### Example @@ -1923,7 +1924,7 @@ client.read() none #### Returns -The next byte (or character), or -1 if none is available. +- The next byte (or character), or -1 if none is available. ### `client.flush()` Waits until all outgoing characters in buffer have been sent. @@ -1979,10 +1980,10 @@ EthernetUDP.begin(localPort); ``` #### Parameters -localPort: the local port to listen on (int) +- localPort: the local port to listen on (int) #### Returns -1 if successful, 0 if there are no sockets available to use. +- 1 if successful, 0 if there are no sockets available to use. #### Example @@ -2054,11 +2055,11 @@ EthernetUDP.read(packetBuffer, MaxSize); ``` #### Parameters -packetBuffer: buffer to hold incoming packets (char) -MaxSize: maximum size of the buffer (int) +- packetBuffer: buffer to hold incoming packets (char) +- MaxSize: maximum size of the buffer (int) #### Returns -char : returns the characters in the buffer +- char : returns the characters in the buffer #### Example @@ -2131,14 +2132,14 @@ EthernetUDP.write(buffer, size); #### Parameters -message: the outgoing message (char) +- message: the outgoing message (char) -buffer: an array to send as a series of bytes (byte or char) +- buffer: an array to send as a series of bytes (byte or char) -size: the length of the buffer +- size: the length of the buffer #### Returns -byte : returns the number of characters sent. This does not have to be read +- byte : returns the number of characters sent. This does not have to be read #### Example @@ -2215,7 +2216,7 @@ EthernetUDP.beginPacket(remoteIP, remotePort); - remoteIP: the IP address of the remote connection (4 bytes) - remotePort: the port of the remote connection (int) #### Returns -Returns an int: 1 if successful, 0 if there was a problem resolving the hostname or port. +- Returns an int: 1 if successful, 0 if there was a problem resolving the hostname or port. #### Example @@ -2267,7 +2268,7 @@ EthernetUDP.endPacket(); None #### Returns -Returns an int: 1 if the packet was sent successfully, 0 if there was an error +- Returns an int: 1 if the packet was sent successfully, 0 if there was an error #### Example @@ -2319,7 +2320,7 @@ EthernetUDP.parsePacket(); None #### Returns -int: the size of a received UDP packet +- int: the size of a received UDP packet #### Example @@ -2383,7 +2384,7 @@ EthernetUDP.available() None #### Returns -the number of bytes available to read +- the number of bytes available to read #### Example @@ -2480,7 +2481,7 @@ UDP.remoteIP(); None #### Returns -4 bytes : the IP address of the remote connection +- 4 bytes : the IP address of the remote connection #### Example @@ -2548,7 +2549,7 @@ UDP.remotePort(); None #### Returns -int : the port of the UDP connection to a remote host +- int : the port of the UDP connection to a remote host #### Example From 32b591cefd899a77b3b4cb43e914bf0d5e1e2e20 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sun, 12 Jun 2022 19:51:25 -0700 Subject: [PATCH 32/43] Remove Paul Stoffregen from list of library maintainers Done at the request of Paul Stoffregen. --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index bcb5c4cf..ef8982a2 100644 --- a/library.properties +++ b/library.properties @@ -1,7 +1,7 @@ name=Ethernet version=2.0.0 author=Various (see AUTHORS file for details) -maintainer=Paul Stoffregen , Arduino +maintainer=Arduino sentence=Enables network connection (local and Internet) using the Arduino Ethernet Board or Shield. paragraph=With this library you can use the Arduino Ethernet (shield or board) to connect to Internet. The library provides both client and server functionalities. The library permits you to connect to a local network also with DHCP and to resolve DNS. category=Communication From eaad5ab5f1179973e2eb7a86301c54c83d1ce97b Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Wed, 6 Jul 2022 08:47:18 +0200 Subject: [PATCH 33/43] Release v2.0.1. --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index ef8982a2..dee6ce04 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Ethernet -version=2.0.0 +version=2.0.1 author=Various (see AUTHORS file for details) maintainer=Arduino sentence=Enables network connection (local and Internet) using the Arduino Ethernet Board or Shield. From b689d3e698e46383be7978855390c83482e794b3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Oct 2022 15:09:03 +0000 Subject: [PATCH 34/43] Bump geekyeggo/delete-artifact from 1 to 2 Bumps [geekyeggo/delete-artifact](https://github.com/geekyeggo/delete-artifact) from 1 to 2. - [Release notes](https://github.com/geekyeggo/delete-artifact/releases) - [Commits](https://github.com/geekyeggo/delete-artifact/compare/v1...v2) --- updated-dependencies: - dependency-name: geekyeggo/delete-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/sync-labels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 986bda6f..10abaeac 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -114,7 +114,7 @@ jobs: path: ${{ env.CONFIGURATIONS_FOLDER }} - name: Remove unneeded artifact - uses: geekyeggo/delete-artifact@v1 + uses: geekyeggo/delete-artifact@v2 with: name: ${{ env.CONFIGURATIONS_ARTIFACT }} From 8ff455ca74aab5974abd651857157d24d938d164 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Oct 2022 15:20:57 +0000 Subject: [PATCH 35/43] Bump carlosperate/download-file-action from 1 to 2 Bumps [carlosperate/download-file-action](https://github.com/carlosperate/download-file-action) from 1 to 2. - [Release notes](https://github.com/carlosperate/download-file-action/releases) - [Commits](https://github.com/carlosperate/download-file-action/compare/v1...v2) --- updated-dependencies: - dependency-name: carlosperate/download-file-action dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/sync-labels.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 10abaeac..94938f35 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -31,7 +31,7 @@ jobs: - name: Download JSON schema for labels configuration file id: download-schema - uses: carlosperate/download-file-action@v1 + uses: carlosperate/download-file-action@v2 with: file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/arduino-tooling-gh-label-configuration-schema.json location: ${{ runner.temp }}/label-configuration-schema @@ -65,7 +65,7 @@ jobs: steps: - name: Download - uses: carlosperate/download-file-action@v1 + uses: carlosperate/download-file-action@v2 with: file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }} From 72462ca2661ef5667fb2482a0b2c48b278c5333f Mon Sep 17 00:00:00 2001 From: Michael Hieke Date: Tue, 28 Feb 2023 19:50:44 +0100 Subject: [PATCH 36/43] Fixes static IPs for Arduino Nano Every The example program WebClient does not work on the Arduino Nano Every when DHCP is not available or commented out - the versions of Ethernet::begin() using a static IP address fail. I tested the example on Uno, Mega2560 and Micro, it works on all of them using either DHCP or static IP. This modifies the begin() method so that it uses IPAddress::raw_address() instead of platform conditional code in the same way the DHCP version of begin() does. With this change static addresses work on the Nano Every too. --- src/Ethernet.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/Ethernet.cpp b/src/Ethernet.cpp index 9257090c..8d9ce7fd 100644 --- a/src/Ethernet.cpp +++ b/src/Ethernet.cpp @@ -83,19 +83,9 @@ void EthernetClass::begin(uint8_t *mac, IPAddress ip, IPAddress dns, IPAddress g if (W5100.init() == 0) return; SPI.beginTransaction(SPI_ETHERNET_SETTINGS); W5100.setMACAddress(mac); -#ifdef ESP8266 - W5100.setIPAddress(&ip[0]); - W5100.setGatewayIp(&gateway[0]); - W5100.setSubnetMask(&subnet[0]); -#elif ARDUINO > 106 || TEENSYDUINO > 121 - W5100.setIPAddress(ip._address.bytes); - W5100.setGatewayIp(gateway._address.bytes); - W5100.setSubnetMask(subnet._address.bytes); -#else - W5100.setIPAddress(ip._address); - W5100.setGatewayIp(gateway._address); - W5100.setSubnetMask(subnet._address); -#endif + W5100.setIPAddress(ip.raw_address()); + W5100.setGatewayIp(gateway.raw_address()); + W5100.setSubnetMask(subnet.raw_address()); SPI.endTransaction(); _dnsServerAddress = dns; } From d5672b707a85874bf69a312b8dce11df710a14d3 Mon Sep 17 00:00:00 2001 From: Martino Facchin Date: Tue, 21 Mar 2023 12:32:42 +0100 Subject: [PATCH 37/43] Release 2.0.2 --- library.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library.properties b/library.properties index dee6ce04..f3f36166 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Ethernet -version=2.0.1 +version=2.0.2 author=Various (see AUTHORS file for details) maintainer=Arduino sentence=Enables network connection (local and Internet) using the Arduino Ethernet Board or Shield. From 882e724d79af5229ac2fe8e0ee94b8af74776dd8 Mon Sep 17 00:00:00 2001 From: Tanish Date: Fri, 14 Apr 2023 02:56:57 +0530 Subject: [PATCH 38/43] fixed no image on website issue earlier the website didn't showed the preview on these images --- docs/readme.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/readme.md b/docs/readme.md index cdb2044c..84d14b2b 100644 --- a/docs/readme.md +++ b/docs/readme.md @@ -4,13 +4,13 @@ This library is designed to work with the Arduino Ethernet Shield, Arduino Ether The Arduino board 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 Ethernet controller chip, but it must be kept as an output or the SPI interface won't work. -![Arduino UNO Pin map.](./arduino_uno_ethernet_pins.png) +![Arduino UNO Pin map.](https://raw.githubusercontent.com/arduino-libraries/Ethernet/master/docs/arduino_uno_ethernet_pins.png) -![Arduino MEGA Pin map.](./arduino_mega_ethernet_pins.png) +![Arduino MEGA Pin map.](https://raw.githubusercontent.com/arduino-libraries/Ethernet/master/docs/arduino_mega_ethernet_pins.png) To use this library ``` #include #include -``` \ No newline at end of file +``` From f5ab51a2444c2dfc033774748fdf17dbba6b0060 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 15:35:29 +0000 Subject: [PATCH 39/43] Bump actions/checkout from 3 to 4 Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/check-arduino.yml | 2 +- .github/workflows/compile-examples.yml | 2 +- .github/workflows/spell-check.yml | 2 +- .github/workflows/sync-labels.yml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/check-arduino.yml b/.github/workflows/check-arduino.yml index 3e0d26c9..adb330f8 100644 --- a/.github/workflows/check-arduino.yml +++ b/.github/workflows/check-arduino.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Arduino Lint uses: arduino/arduino-lint-action@v1 diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index 1e73ea3e..b004024b 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -85,7 +85,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Compile examples uses: arduino/compile-sketches@v1 diff --git a/.github/workflows/spell-check.yml b/.github/workflows/spell-check.yml index 3f6b03fb..ef7d8941 100644 --- a/.github/workflows/spell-check.yml +++ b/.github/workflows/spell-check.yml @@ -16,7 +16,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Spell check uses: codespell-project/actions-codespell@master diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 94938f35..9cde1acc 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -27,7 +27,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download JSON schema for labels configuration file id: download-schema @@ -105,7 +105,7 @@ jobs: echo "::set-output name=flag::--dry-run" - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Download configuration files artifact uses: actions/download-artifact@v3 From 302c26f9f6a09be2db9c2a8832992b28ba9271d3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 09:54:08 +0100 Subject: [PATCH 40/43] Bump geekyeggo/delete-artifact from 2 to 4 (#245) Bumps [geekyeggo/delete-artifact](https://github.com/geekyeggo/delete-artifact) from 2 to 4. - [Release notes](https://github.com/geekyeggo/delete-artifact/releases) - [Changelog](https://github.com/GeekyEggo/delete-artifact/blob/main/CHANGELOG.md) - [Commits](https://github.com/geekyeggo/delete-artifact/compare/v2...v4) --- updated-dependencies: - dependency-name: geekyeggo/delete-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/sync-labels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 9cde1acc..c15b6dbe 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -114,7 +114,7 @@ jobs: path: ${{ env.CONFIGURATIONS_FOLDER }} - name: Remove unneeded artifact - uses: geekyeggo/delete-artifact@v2 + uses: geekyeggo/delete-artifact@v4 with: name: ${{ env.CONFIGURATIONS_ARTIFACT }} From e1767f9939b5eae0b62fd32da6f0b6bc98e47190 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 09:54:25 +0100 Subject: [PATCH 41/43] Bump actions/download-artifact from 3 to 4 (#244) Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 3 to 4. - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/sync-labels.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index c15b6dbe..22d98bed 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -108,7 +108,7 @@ jobs: uses: actions/checkout@v4 - name: Download configuration files artifact - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: name: ${{ env.CONFIGURATIONS_ARTIFACT }} path: ${{ env.CONFIGURATIONS_FOLDER }} From 351463a01b9ad0c7929fe983e00bf590559e4e84 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 5 Mar 2024 09:54:39 +0100 Subject: [PATCH 42/43] Bump actions/upload-artifact from 3 to 4 (#243) Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/compile-examples.yml | 2 +- .github/workflows/sync-labels.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index b004024b..b0d07570 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -104,7 +104,7 @@ jobs: sketches-report-path: ${{ env.SKETCHES_REPORTS_PATH }} - name: Save sketches report as workflow artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: if-no-files-found: error path: ${{ env.SKETCHES_REPORTS_PATH }} diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml index 22d98bed..47ac50a4 100644 --- a/.github/workflows/sync-labels.yml +++ b/.github/workflows/sync-labels.yml @@ -70,7 +70,7 @@ jobs: file-url: https://raw.githubusercontent.com/arduino/tooling-project-assets/main/workflow-templates/assets/sync-labels/${{ matrix.filename }} - name: Pass configuration files to next job via workflow artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: path: | *.yaml From ae040a19de82589c185d2b817a36162326db5cc0 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Tue, 5 Mar 2024 10:17:34 +0100 Subject: [PATCH 43/43] Fix regression report-size-deltas after updating upload-artifact. (#253) For more information see https://github.com/arduino/report-size-deltas/blob/main/docs/FAQ.md#size-deltas-report-workflow-triggered-by-schedule-event . --- .github/workflows/compile-examples.yml | 19 ++++++++++++++++++- .github/workflows/report-size-deltas.yml | 4 ++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/compile-examples.yml b/.github/workflows/compile-examples.yml index b0d07570..2812cf08 100644 --- a/.github/workflows/compile-examples.yml +++ b/.github/workflows/compile-examples.yml @@ -34,54 +34,71 @@ jobs: - fqbn: arduino:avr:nano platforms: | - name: arduino:avr + artifact-name-suffix: arduino-avr-nano - fqbn: arduino:avr:mega platforms: | - name: arduino:avr + artifact-name-suffix: arduino-avr-mega - fqbn: arduino:avr:leonardo platforms: | - name: arduino:avr + artifact-name-suffix: arduino-avr-leonardo - fqbn: arduino:megaavr:uno2018 platforms: | - name: arduino:megaavr + artifact-name-suffix: arduino-megaavr-uno2018 - fqbn: arduino:megaavr:nona4809 platforms: | - name: arduino:megaavr + artifact-name-suffix: arduino-megaavr-nona4809 - fqbn: arduino:sam:arduino_due_x_dbg platforms: | - name: arduino:sam + artifact-name-suffix: arduino-sam-arduino_due_x_dbg - fqbn: arduino:samd:arduino_zero_edbg platforms: | - name: arduino:samd + artifact-name-suffix: arduino-samd-arduino_zero_edbg - fqbn: arduino:samd:mkr1000 platforms: | - name: arduino:samd + artifact-name-suffix: arduino-samd-mkr1000 - fqbn: arduino:samd:mkrzero platforms: | - name: arduino:samd + artifact-name-suffix: arduino-samd-mkrzero - fqbn: arduino:samd:mkrwifi1010 platforms: | - name: arduino:samd + artifact-name-suffix: arduino-samd-mkrwifi100 - fqbn: arduino:samd:mkrfox1200 platforms: | - name: arduino:samd + artifact-name-suffix: arduino-samd-mkr1200 - fqbn: arduino:samd:mkrwan1300 platforms: | - name: arduino:samd + artifact-name-suffix: arduino-samd-mkrwan1300 - fqbn: arduino:samd:mkrwan1310 platforms: | - name: arduino:samd + artifact-name-suffix: arduino-samd-mkrwan1310 - fqbn: arduino:samd:mkrgsm1400 platforms: | - name: arduino:samd + artifact-name-suffix: arduino-samd-mkrgsm1400 - fqbn: arduino:samd:mkrnb1500 platforms: | - name: arduino:samd + artifact-name-suffix: arduino-samd-mkrnb1500 - fqbn: arduino:samd:mkrvidor4000 platforms: | - name: arduino:samd + artifact-name-suffix: arduino-samd-mkrvidor4000 - fqbn: arduino:samd:nano_33_iot platforms: | - name: arduino:samd + artifact-name-suffix: arduino-samd-nano_33_iot steps: - name: Checkout repository @@ -108,4 +125,4 @@ jobs: with: if-no-files-found: error path: ${{ env.SKETCHES_REPORTS_PATH }} - name: ${{ env.SKETCHES_REPORTS_PATH }} + name: sketches-report-${{ matrix.board.artifact-name-suffix }} diff --git a/.github/workflows/report-size-deltas.yml b/.github/workflows/report-size-deltas.yml index 652be5d9..39e2a0ad 100644 --- a/.github/workflows/report-size-deltas.yml +++ b/.github/workflows/report-size-deltas.yml @@ -20,5 +20,5 @@ jobs: - name: Comment size deltas reports to PRs uses: arduino/report-size-deltas@v1 with: - # The name of the workflow artifact created by the sketch compilation workflow - sketches-reports-source: sketches-reports + # Regex matching the names of the workflow artifacts created by the "Compile Examples" workflow + sketches-reports-source: ^sketches-report-.+