Remove trailing spaces
This commit is contained in:
parent
a3cfbb543f
commit
37fb6745a0
@ -88,14 +88,14 @@ void sendNTPpacket() {
|
|||||||
packetBuffer[15] = 52;
|
packetBuffer[15] = 52;
|
||||||
|
|
||||||
// all NTP fields have been given values, now
|
// all NTP fields have been given values, now
|
||||||
// you can send a packet requesting a timestamp:
|
// you can send a packet requesting a timestamp:
|
||||||
Udp.beginPacket(timeserver, 123); //NTP requests are to port 123
|
Udp.beginPacket(timeserver, 123); //NTP requests are to port 123
|
||||||
Udp.write(packetBuffer,NTP_PACKET_SIZE);
|
Udp.write(packetBuffer,NTP_PACKET_SIZE);
|
||||||
Udp.endPacket();
|
Udp.endPacket();
|
||||||
Serial.println("Sending ntp packet");
|
Serial.println("Sending ntp packet");
|
||||||
|
|
||||||
delay(1000);
|
delay(1000);
|
||||||
if ( Udp.parsePacket() ) {
|
if ( Udp.parsePacket() ) {
|
||||||
// We've received a packet, read the data from it
|
// We've received a packet, read the data from it
|
||||||
Udp.read(packetBuffer,NTP_PACKET_SIZE); // read the packet into the buffer
|
Udp.read(packetBuffer,NTP_PACKET_SIZE); // read the packet into the buffer
|
||||||
|
|
||||||
@ -103,15 +103,15 @@ void sendNTPpacket() {
|
|||||||
// or two words, long. First, esxtract the two words:
|
// or two words, long. First, esxtract the two words:
|
||||||
|
|
||||||
unsigned long highWord = word(packetBuffer[40], packetBuffer[41]);
|
unsigned long highWord = word(packetBuffer[40], packetBuffer[41]);
|
||||||
unsigned long lowWord = word(packetBuffer[42], packetBuffer[43]);
|
unsigned long lowWord = word(packetBuffer[42], packetBuffer[43]);
|
||||||
// combine the four bytes (two words) into a long integer
|
// combine the four bytes (two words) into a long integer
|
||||||
// this is NTP time (seconds since Jan 1 1900):
|
// this is NTP time (seconds since Jan 1 1900):
|
||||||
unsigned long secsSince1900 = highWord << 16 | lowWord;
|
unsigned long secsSince1900 = highWord << 16 | lowWord;
|
||||||
// Unix time starts on Jan 1 1970. In seconds, that's 2208988800:
|
// Unix time starts on Jan 1 1970. In seconds, that's 2208988800:
|
||||||
const unsigned long seventyYears = 2208988800UL;
|
const unsigned long seventyYears = 2208988800UL;
|
||||||
// subtract seventy years:
|
// subtract seventy years:
|
||||||
unsigned long epoch = secsSince1900 - seventyYears + TIMEZONE;
|
unsigned long epoch = secsSince1900 - seventyYears + TIMEZONE;
|
||||||
|
|
||||||
Serial.println("Adjusting time");
|
Serial.println("Adjusting time");
|
||||||
chronodot.adjust(DateTime(epoch));
|
chronodot.adjust(DateTime(epoch));
|
||||||
}
|
}
|
||||||
@ -148,7 +148,7 @@ void setup() {
|
|||||||
tsl.setTiming(TSL2561_INTEGRATIONTIME_13MS); // shortest integration time (bright light)
|
tsl.setTiming(TSL2561_INTEGRATIONTIME_13MS); // shortest integration time (bright light)
|
||||||
//tsl.setTiming(TSL2561_INTEGRATIONTIME_101MS); // medium integration time (medium light)
|
//tsl.setTiming(TSL2561_INTEGRATIONTIME_101MS); // medium integration time (medium light)
|
||||||
//tsl.setTiming(TSL2561_INTEGRATIONTIME_402MS); // longest integration time (dim light)
|
//tsl.setTiming(TSL2561_INTEGRATIONTIME_402MS); // longest integration time (dim light)
|
||||||
|
|
||||||
Udp.begin(8888);
|
Udp.begin(8888);
|
||||||
sendNTPpacket();
|
sendNTPpacket();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user