Universal Maker Sensor Kit - code issie

I was trying to run Lesson 16: Real Time Clock Module. The sample code references the library module DS1302 (ds1302.py). I have the module in the same folder as my code for RealTimeClockExample (RealTimeClockExample.py).


from machine import Pin
import ds1302
import time

Initialize DS1302 RTC with specific GPIO pins

ds = ds1302.DS1302(Pin(5), Pin(18), Pin(19)) # (clk, dio, cs)

Get current datetime from DS1302

ds.date_time()

Set DS1302 datetime to 2024-01-01 Monday 00:00:00

ds.date_time([2024, 1, 1, 1, 0, 0, 0]) # (year,month,day,weekday,hour,minute,second)

Set seconds to 10

ds.second(10)

Continuously display current datetime every half second

while True:
print(ds.date_time())
time.sleep(0.5)


Yet, when I run the code in Thonny (on my PC connected to a Rasberry Pi Pico W), I get the following error:
Traceback (most recent call last):
File “”, line 2, in
ImportError: no module named ‘ds1302’

Therefore, the ds1302 module is not getting picked up and loaded in the system. I don’t understand why this is happening.

Does anyone know what I am missing or not understanding?

Thanks for your response!

ImportError: There is no module named ‘ds1302’, this error means that you have not uploaded the ds1302 libraries to pico W correctly.
Please follow this link to upload all libraries:
https://docs.sunfounder.com/projects/umsk/en/latest/04_pi_pico/pico_start/04_upload_libraries.html
Then run the real time clock module example.

Thank you so much for that information. I had not seen that section previously. Once I changed the Thonny interface to standard, I could see the View menu option.

Then I was able to successfully import the provided library modules.

Thanks again!

Best regards,
Michael