Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit b86aa29

Browse files
authored
v1.5.1 for ESP32 + ENC28J60
#### Releases v1.5.1 1. Initial coding to support ESP32 boards using ENC28J60 LwIP Ethernet. Sync with [WebServer_WT32_ETH01 v1.5.1](https://github.com/khoih-prog/WebServer_WT32_ETH01)
1 parent 50d6e4d commit b86aa29

File tree

6 files changed

+25
-28
lines changed

6 files changed

+25
-28
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ ESP32_Pub
466466
Attempting MQTT connection to broker.emqx.io
467467
...connected
468468
Published connection message successfully!
469-
Subcribed to: ESP32_Sub
469+
Subscribed to: ESP32_Sub
470470
MQTT Message Send : ESP32_Pub => Hello from MQTT_ThingStream on ESP32_DEV with ESP32_ENC28J60
471471
MQTT Message receive [ESP32_Pub] Hello from MQTT_ThingStream on ESP32_DEV with ESP32_ENC28J60
472472
MQTT Message Send : ESP32_Pub => Hello from MQTT_ThingStream on ESP32_DEV with ESP32_ENC28J60

examples/MQTTClient_Auth/MQTTClient_Auth.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ const char* mqttServer = "broker.emqx.io"; // Broker address
9595
//const char* mqttServer = "broker.shiftr.io"; // Broker address
9696

9797
const char *ID = "MQTTClient_SSL-Client"; // Name of our device, must be unique
98-
const char *TOPIC = "MQTT_Pub"; // Topic to subcribe to
99-
const char *subTopic = "MQTT_Sub"; // Topic to subcribe to
98+
const char *TOPIC = "MQTT_Pub"; // Topic to subscribe to
99+
const char *subTopic = "MQTT_Sub"; // Topic to subscribe to
100100

101101
//IPAddress mqttServer(172, 16, 0, 2);
102102

@@ -136,7 +136,7 @@ void reconnect()
136136
client.publish(TOPIC, data.c_str());
137137

138138
//Serial.println("Published connection message successfully!");
139-
//Serial.print("Subcribed to: ");
139+
//Serial.print("Subscribed to: ");
140140
//Serial.println(subTopic);
141141

142142
// This is a workaround to address https://github.com/OPEnSLab-OSU/SSLClient/issues/9

examples/MQTTClient_Basic/MQTTClient_Basic.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ const char* mqttServer = "broker.emqx.io"; // Broker address
9696
//const char* mqttServer = "broker.shiftr.io"; // Broker address
9797

9898
const char *ID = "MQTTClient_SSL-Client"; // Name of our device, must be unique
99-
const char *TOPIC = "MQTT_Pub"; // Topic to subcribe to
100-
const char *subTopic = "MQTT_Sub"; // Topic to subcribe to
99+
const char *TOPIC = "MQTT_Pub"; // Topic to subscribe to
100+
const char *subTopic = "MQTT_Sub"; // Topic to subscribe to
101101

102102
//IPAddress mqttServer(172, 16, 0, 2);
103103

@@ -137,7 +137,7 @@ void reconnect()
137137
client.publish(TOPIC, data.c_str());
138138

139139
//Serial.println("Published connection message successfully!");
140-
//Serial.print("Subcribed to: ");
140+
//Serial.print("Subscribed to: ");
141141
//Serial.println(subTopic);
142142

143143
// This is a workaround to address https://github.com/OPEnSLab-OSU/SSLClient/issues/9

examples/MQTT_ThingStream/MQTT_ThingStream.ino

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ const char my_key[] = "FIXME";
119119
const char* MQTT_SERVER = "broker.emqx.io"; // Broker address
120120

121121
const char* ID = "MQTTClient_SSL-Client"; // Name of our device, must be unique
122-
String topic = "ESP32_Pub"; // Topic to subcribe to
123-
String subTopic = "ESP32_Sub"; // Topic to subcribe to
122+
String topic = "ESP32_Pub"; // Topic to subscribe to
123+
String subTopic = "ESP32_Sub"; // Topic to subscribe to
124124

125125
#endif
126126

@@ -182,7 +182,7 @@ void reconnect()
182182

183183
Serial.println("Published connection message successfully!");
184184

185-
Serial.print("Subcribed to: ");
185+
Serial.print("Subscribed to: ");
186186
Serial.println(subTopic);
187187

188188
// This is a workaround to address https://github.com/OPEnSLab-OSU/SSLClient/issues/9

examples/UdpNTPClient/UdpNTPClient.ino

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/****************************************************************************************************************************
22
UdpNTPClient.ino - Simple Arduino web server sample for ESP8266 AT-command shield
3-
3+
44
For Ethernet shields using ESP32_ENC (ESP32 + ENC28J60)
55
66
WebServer_ESP32_ENC is a library for the ESP32 with Ethernet ENC28J60 to run WebServer
@@ -81,7 +81,7 @@ char timeServer[] = "time.nist.gov"; // NTP server
8181
unsigned int localPort = 2390; // local port to listen for UDP packets
8282

8383
const int NTP_PACKET_SIZE = 48; // NTP timestamp is in the first 48 bytes of the message
84-
const int UDP_TIMEOUT = 2000; // timeout in miliseconds to wait for an UDP packet to arrive
84+
const int UDP_TIMEOUT = 2000; // timeout in milliseconds to wait for an UDP packet to arrive
8585

8686
byte packetBuffer[NTP_PACKET_SIZE]; // buffer to hold incoming and outgoing packets
8787

@@ -118,7 +118,6 @@ void sendNTPpacket(char *ntpSrv)
118118
void setup()
119119
{
120120
Serial.begin(115200);
121-
122121
while (!Serial && (millis() < 5000));
123122

124123
Serial.print(F("\nStart UdpNTPClient on "));
@@ -157,17 +156,16 @@ void setup()
157156
ESP32_ENC_waitForConnect();
158157

159158
///////////////////////////////////
160-
159+
161160
Udp.begin(localPort);
162161
}
163162

164163
void loop()
165164
{
166165
sendNTPpacket(timeServer); // send an NTP packet to a time server
167166

168-
// wait for a reply for UDP_TIMEOUT miliseconds
167+
// wait for a reply for UDP_TIMEOUT milliseconds
169168
unsigned long startMs = millis();
170-
171169
while (!Udp.available() && (millis() - startMs) < UDP_TIMEOUT) {}
172170

173171
// if there's data available, read a packet
@@ -195,7 +193,7 @@ void loop()
195193
// combine the four bytes (two words) into a long integer
196194
// this is NTP time (seconds since Jan 1 1900):
197195
unsigned long secsSince1900 = highWord << 16 | lowWord;
198-
196+
199197
Serial.print(F("Seconds since Jan 1 1900 = "));
200198
Serial.println(secsSince1900);
201199

@@ -212,25 +210,25 @@ void loop()
212210
Serial.print(F("The UTC time is ")); // UTC is the time at Greenwich Meridian (GMT)
213211
Serial.print((epoch % 86400L) / 3600); // print the hour (86400 equals secs per day)
214212
Serial.print(F(":"));
215-
216-
if (((epoch % 3600) / 60) < 10)
213+
214+
if (((epoch % 3600) / 60) < 10)
217215
{
218216
// In the first 10 minutes of each hour, we'll want a leading '0'
219217
Serial.print(F("0"));
220218
}
221-
219+
222220
Serial.print((epoch % 3600) / 60); // print the minute (3600 equals secs per minute)
223221
Serial.print(F(":"));
224-
225-
if ((epoch % 60) < 10)
222+
223+
if ((epoch % 60) < 10)
226224
{
227225
// In the first 10 seconds of each minute, we'll want a leading '0'
228226
Serial.print(F("0"));
229227
}
230-
228+
231229
Serial.println(epoch % 60); // print the second
232230
}
233-
231+
234232
// wait ten seconds before asking for the time again
235233
delay(10000);
236234
}

examples/UdpSendReceive/UdpSendReceive.ino

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/****************************************************************************************************************************
22
UDPSendReceive.ino - Simple Arduino web server sample for ESP8266/ESP32 AT-command shield
3-
3+
44
For Ethernet shields using ESP32_ENC (ESP32 + ENC28J60)
55
66
WebServer_ESP32_ENC is a library for the ESP32 with Ethernet ENC28J60 to run WebServer
@@ -76,7 +76,7 @@ char timeServer[] = "time.nist.gov"; // NTP server
7676
unsigned int localPort = 2390; // local port to listen for UDP packets
7777

7878
const int NTP_PACKET_SIZE = 48; // NTP timestamp is in the first 48 bytes of the message
79-
const int UDP_TIMEOUT = 2000; // timeout in miliseconds to wait for an UDP packet to arrive
79+
const int UDP_TIMEOUT = 2000; // timeout in milliseconds to wait for an UDP packet to arrive
8080

8181
byte packetBuffer[NTP_PACKET_SIZE]; // buffer to hold incoming packet
8282
byte ReplyBuffer[] = "ACK"; // a string to send back
@@ -114,7 +114,6 @@ void sendNTPpacket(char *ntpSrv)
114114
void setup()
115115
{
116116
Serial.begin(115200);
117-
118117
while (!Serial && (millis() < 5000));
119118

120119
Serial.print(F("\nStart UDPSendReceive on "));
@@ -166,7 +165,7 @@ void loop()
166165
{
167166
sendNTPpacket(timeServer); // send an NTP packet to a time server
168167

169-
// wait for a reply for UDP_TIMEOUT miliseconds
168+
// wait for a reply for UDP_TIMEOUT milliseconds
170169
unsigned long startMs = millis();
171170

172171
while (!Udp.available() && (millis() - startMs) < UDP_TIMEOUT) {}

0 commit comments

Comments
 (0)