Do you remember wind-up clocks? Having to check the time on the clock ticking away on your bedside table every time you happened to hear the radio announce the time so you could adjust it? Of course after the apocalypse, there will be no internet so wind up clocks will be in demand again and everyone will have to re-learn how to read an analog clock. Until then I will incorporate your simple time example in most of my esp8266 or esp32 projects. Thank you!
@markotomasevic8028
24 күн бұрын
nice,simple and clear. thats what we want. thanks man
@unrealcompanymusic
2 жыл бұрын
I finally found an understandable channel .. waiting for the next video!
@alham__aa
Жыл бұрын
DAMN! explained a bit advance topic very easily and shortly😅
@user-dz5wg9zk8e
Жыл бұрын
Hi Bhavesh, many thanks for this super video. I have one problem/question: I'm living here in germany and my problem is the switching between winter (UTC_DELAY = 1 h) and summer (UTC_DELAY = 2h) - time Any idea how to achieve this AUTOMATICALY!
@BhaveshKakwani
Жыл бұрын
Great question! You can add some simple logic to check the date and see if it's before or after the last Sunday of the month in March/October. Alternatively, it may be easier to just use this API to determine if daylight savings is "true" or "false" at the current time, and use that to adjust your UTC_DELAY: worldtimeapi.org/ For the 2nd option, please see my short video on how to make web requests with Micropython (the "Joke API" video) Hope this helps! Good luck 😀
@oilbanedata394
Жыл бұрын
👍👍
@AndreasDelleske
Жыл бұрын
Which NTP server will it ask? Can I set a different one? Thanks for your videos!
@BhaveshKakwani
Жыл бұрын
Hi Andreas, it asks "pool.ntp.org" as you can see in the source code, assigned to the "host" variable: (github.com/micropython/micropython-lib/blob/master/micropython/net/ntptime/ntptime.py ) If you need to set it to a different server, maybe your best bet is to just copy the simple source code above and change the "host" variable to the one you want
@AndreasDelleske
Жыл бұрын
@@BhaveshKakwani Oh wow many thanks I didn't know where the sourcecode is.. I'll make something like a pull request to make it configurable, sometimes one must use a local one.
@BhaveshKakwani
Жыл бұрын
@@AndreasDelleske That would be great! Lemme know if you need help with it. Should just be a simple optional parameter (with default value of pool.ntp.org) to the function, I think
@AndreasDelleske
Жыл бұрын
@@BhaveshKakwani I will: Let''s hope for the best..
@Dasol0246
2 жыл бұрын
Used a ESP8266 with MU editor, it works like a charm. However, when I use a ESP32 with Thonny editor I can not get the ntptime.settime() to work, Strange. Thanks for your tutorial
@Dasol0246
2 жыл бұрын
I was using Micropython V1.14, had to upgrade to V1.18. Now the esp32 works also
@rayoseldev819
2 жыл бұрын
I have this error ModuleNotFoundError: No module named 'ntptime' And I have tryed to do pip install ntptime but can't
@BhaveshKakwani
2 жыл бұрын
Hi Rayos! Are you running on an ESP32? Which version of MicroPython are you using?
@rayoseldev819
2 жыл бұрын
@@BhaveshKakwani ESP32? i don'0t know it, I run it from windows. OH micro python is not python? :S
@BhaveshKakwani
2 жыл бұрын
Yes, “Micropython” is different and it’s made specifically for electronics/hardware projects. Similar to Arduino, if you are familiar with that. If you want to access NTP servers in normal Python, you should use the ntplib library: github.com/cf-natali/ntplib
@flaried9345
2 жыл бұрын
all your videos are really interesting and I love learning about micro python, this channels underrated for how much you can learn from it.
@BhaveshKakwani
2 жыл бұрын
Glad to hear it! 😄
@gracc46
2 жыл бұрын
Very informative and easy to understand.Have looked at heaps of other videos on this subject and yours was the easiest to understand,well done.
@BhaveshKakwani
2 жыл бұрын
yay! Glad it helped
@_XY_
2 жыл бұрын
👏👏
@ihsanshafi1047
2 жыл бұрын
how do i get the hour minute and second separately
@BhaveshKakwani
2 жыл бұрын
Great question! Since the time is output as a tuple, you can treat it like any normal tuple or list in Python: hour = actual_time[3] minute = actual_time[4] second = actual_time[5]
@ihsanshafi1047
2 жыл бұрын
@@BhaveshKakwani if you don't mind me asking is their a way to get the time in a 12 hour format
@BhaveshKakwani
2 жыл бұрын
@@ihsanshafi1047 Yes totally. Write a simple "if" condition that does this: - If the hours is greater than 12, subtract 12 to convert into 12-hr format and add "PM" to it. - If the hours is less than 12, just add "AM" to it - If the hours is exactly 12, then it is 12 PM - If the hours is exactly 0, then it is 12 AM For example: 21 is greater than 12, so subtract 12 to get "9 PM" Another example: 6 is less than 12, so it is "6 AM"
Пікірлер: 28