Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Script by: Peter Lunk
- """
- This MicroPython script is for Raspberry Pi Pico W (Wifi) device
- that connects to a Wi-Fi network and synchronizes its time with
- a NTP (Network Time Protocol) server.
- The script first sets up a connection to the Wi-Fi network using
- the specified ssid (network name) and password, and then sets
- the device's time using the ntptime.settime() function.
- The device continuously retrieves the current time from internal
- clock and displays it along with the current date and day of the
- year on the serial monitor every second.
- The script synchronizes the time with NTP every day at midnight.
- """
- import network
- import socket
- import time
- import struct
- import ntptime
- from machine import Pin
- led = Pin("LED", Pin.OUT)
- x = 1
- Hour = ""
- Minute = ""
- Seconds = ""
- Maanden = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Okt","Nov","Dec"]
- WeekDagen = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
- ____________________________________________________
- Looking for the final full script ?
- Link:
- https://github.com/mrlunk/Raspberry-Pi-Pico
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement