AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Rtc setdate8/3/2023 You should now see the date and time displaying on the board’s OLED screen on lines 2 and 3. Oled.displayText(rtc.readTimeString(), 3) Oled.displayText(rtc.readDateString(), 2) To get started, we can display the date and time from the RTC on the OLED, rather than using the Thonny Shell.Īlter your code to look like the following, and then click run: from PicoAirQuality import KitronikOLED, KitronikRTC The OLED display screen is a great way to add a visual output to your programs, and there are functions for displaying text, drawing lines and shapes, and even plotting live graphs. It is not very convenient having the Pico connected to Thonny to actually be able to see the time, so let’s combine this with another feature, the OLED display screen. SetTime takes parameters in the order Hours, Minutes, Seconds. SetDate takes parameters in the order Day, Month, Year. Try altering your code to set the date and time to the current date and time. You should see the date and time displaying in the Thonny Shell, updating every second.Īs you can see, it is very simple to set and read both the date and time on the Pico. With the Pico correctly mounted on the board and connected to Thonny,Ĭreate and run the following code : from PicoAirQuality import KitronikRTC With the PicoAirQuality module, there are functions available for setting the date and time, reading them back – including all the individual parameters day, month, year, hours, minutes, seconds – and creating alarms. RTCs are very useful for accurately keeping track of time and in the Data Logging Tutorial we will make use of this to provide date and time stamps for data logging. The Pico has a number of built-in features beyond just having lots of pins for controlling and communicating with external devices, and one of these is the real-time clock (RTC). MicroPython: KitronikLtd/Kitronik-Pico-Smart-Air-Quality-Board-MicroPythonĬlone or download the repository and then copy / save the PicoAirQuality.py file to your Pico.If you are new to using modules with the Pico, there is a helpful guide providing practical examples and explanations on how to do so. If the words "Clone the repo" mean nothing then check out our guide to git Kitronik have written a module to use with the Pico Smart Air Quality Board which is available, along with sample programs, in the Kitronik GitHub. Kitronik have also written a First Steps Tutorial to get you started using the Pico with the Thonny Editor. If you are new to the Pico, and Python development, check out Raspberry Pi's guide to get you started
0 Comments
Read More
Leave a Reply. |