This repository has been archived by the owner on Feb 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
multiFileProject.ino
76 lines (56 loc) · 2.5 KB
/
multiFileProject.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/****************************************************************************************************************************
multiFileProject.ino
AsyncUDP_ESP32_SC_ENC is a Async UDP library for the ESP32_SC_ENC (ESP32_S2/S3/C3 + ENC28J60)
Based on and modified from ESPAsyncUDP Library (https://github.com/me-no-dev/ESPAsyncUDP)
Built by Khoi Hoang https://github.com/khoih-prog/AsyncUDP_ESP32_SC_ENC
Licensed under GPLv3 license
*****************************************************************************************************************************/
// To demo how to include files in multi-file Projects
#include "multiFileProject.h"
// Can be included as many times as necessary, without `Multiple Definitions` Linker Error
#include "AsyncUDP_ESP32_SC_ENC.h"
// Select the IP address according to your local network
IPAddress myIP(192, 168, 2, 232);
IPAddress myGW(192, 168, 2, 1);
IPAddress mySN(255, 255, 255, 0);
// Google DNS Server IP
IPAddress myDNS(8, 8, 8, 8);
void setup()
{
Serial.begin(115200);
while (!Serial && (millis() < 5000));
delay(500);
Serial.print(F("\nStart multiFileProject on "));
Serial.print(ARDUINO_BOARD);
Serial.print(F(" with "));
Serial.println(SHIELD_TYPE);
Serial.println(WEBSERVER_ESP32_SC_ENC_VERSION);
Serial.println(ASYNC_UDP_ESP32_SC_ENC_VERSION);
Serial.setDebugOutput(true);
UDP_LOGWARN(F("Default SPI pinout:"));
UDP_LOGWARN1(F("SPI_HOST:"), ETH_SPI_HOST);
UDP_LOGWARN1(F("MOSI:"), MOSI_GPIO);
UDP_LOGWARN1(F("MISO:"), MISO_GPIO);
UDP_LOGWARN1(F("SCK:"), SCK_GPIO);
UDP_LOGWARN1(F("CS:"), CS_GPIO);
UDP_LOGWARN1(F("INT:"), INT_GPIO);
UDP_LOGWARN1(F("SPI Clock (MHz):"), SPI_CLOCK_MHZ);
UDP_LOGWARN(F("========================="));
///////////////////////////////////
// To be called before ETH.begin()
ESP32_ENC_onEvent();
// start the ethernet connection and the server:
//bool begin(int MISO_GPIO, int MOSI_GPIO, int SCLK_GPIO, int CS_GPIO, int INT_GPIO, int SPI_CLOCK_MHZ,
// int SPI_HOST, uint8_t *ENC28J60_Mac = ENC28J60_Default_Mac);
ETH.begin( MISO_GPIO, MOSI_GPIO, SCK_GPIO, CS_GPIO, INT_GPIO, SPI_CLOCK_MHZ, ETH_SPI_HOST );
// Static IP, leave without this line to get IP via DHCP
//bool config(IPAddress local_ip, IPAddress gateway, IPAddress subnet, IPAddress dns1 = 0, IPAddress dns2 = 0);
ETH.config(myIP, myGW, mySN, myDNS);
ESP32_ENC_waitForConnect();
///////////////////////////////////
Serial.print("You're OK now");
}
void loop()
{
// put your main code here, to run repeatedly:
}