Turn to W5500 Chip
This commit is contained in:
parent
a5c1b98bae
commit
0ff0896273
@ -1,13 +1,13 @@
|
|||||||
#include <NTPClient.h>
|
#include <NTPClient.h>
|
||||||
#include <Ethernet.h>
|
#include <Ethernet2.h>
|
||||||
#include "EthernetUdp.h"
|
#include "EthernetUdp2.h"
|
||||||
#include "DFRobotDFPlayerMini.h"
|
#include "DFRobotDFPlayerMini.h"
|
||||||
#include "SoftwareSerial.h"
|
#include "SoftwareSerial.h"
|
||||||
|
|
||||||
byte mac[] = {
|
byte mac[] = {
|
||||||
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
|
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
|
||||||
};
|
};
|
||||||
|
int sensorValue = 0;
|
||||||
SoftwareSerial mySoftwareSerial(2, 3); // RX, TX
|
SoftwareSerial mySoftwareSerial(2, 3); // RX, TX
|
||||||
EthernetUDP ntpUDP;
|
EthernetUDP ntpUDP;
|
||||||
DFRobotDFPlayerMini myDFPlayer;
|
DFRobotDFPlayerMini myDFPlayer;
|
||||||
@ -32,18 +32,15 @@ void setup(){
|
|||||||
//----Set volume----
|
//----Set volume----
|
||||||
myDFPlayer.volume(15); //Set volume value (0~30).
|
myDFPlayer.volume(15); //Set volume value (0~30).
|
||||||
|
|
||||||
Ethernet.begin(mac);
|
// start the Ethernet connection:
|
||||||
|
if (Ethernet.begin(mac) == 0) {
|
||||||
// Check for Ethernet hardware present
|
Serial.println("Failed to configure Ethernet using DHCP");
|
||||||
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
|
|
||||||
Serial.println("Ethernet shield was not found. Sorry, can't run without hardware. :(");
|
|
||||||
while (true) {
|
while (true) {
|
||||||
delay(1); // do nothing, no point running without Ethernet hardware
|
delay(1); // do nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Ethernet.linkStatus() == LinkOFF) {
|
|
||||||
Serial.println("Ethernet cable is not connected.");
|
pinMode(5, OUTPUT);
|
||||||
}
|
|
||||||
|
|
||||||
timeClient.begin();
|
timeClient.begin();
|
||||||
}
|
}
|
||||||
@ -136,7 +133,7 @@ void loop() {
|
|||||||
} else if (hour == "09") {
|
} else if (hour == "09") {
|
||||||
myDFPlayer.playMp3Folder(930);
|
myDFPlayer.playMp3Folder(930);
|
||||||
} else if (hour == "10") {
|
} else if (hour == "10") {
|
||||||
myDFPlayer.playMp3Folder(1300);
|
myDFPlayer.playMp3Folder(1030);
|
||||||
} else if (hour == "11") {
|
} else if (hour == "11") {
|
||||||
myDFPlayer.playMp3Folder(1130);
|
myDFPlayer.playMp3Folder(1130);
|
||||||
} else if (hour == "12") {
|
} else if (hour == "12") {
|
||||||
@ -156,7 +153,7 @@ void loop() {
|
|||||||
} else if (hour == "19") {
|
} else if (hour == "19") {
|
||||||
myDFPlayer.playMp3Folder(1930);
|
myDFPlayer.playMp3Folder(1930);
|
||||||
} else if (hour == "20") {
|
} else if (hour == "20") {
|
||||||
myDFPlayer.playMp3Folder(2300);
|
myDFPlayer.playMp3Folder(2030);
|
||||||
} else if (hour == "21") {
|
} else if (hour == "21") {
|
||||||
myDFPlayer.playMp3Folder(2130);
|
myDFPlayer.playMp3Folder(2130);
|
||||||
} else if (hour == "22") {
|
} else if (hour == "22") {
|
||||||
@ -167,6 +164,14 @@ void loop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sensorValue = analogRead(A0);
|
||||||
|
Serial.println(sensorValue);
|
||||||
|
if (sensorValue < 500) {
|
||||||
|
digitalWrite(5, HIGH);
|
||||||
|
} else {
|
||||||
|
digitalWrite(5, LOW);
|
||||||
|
}
|
||||||
|
|
||||||
delay(500);
|
delay(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user