A simple square wave clock for the Raspberry Pi Pico.
To instantiate and use a PIO Clock:
- Import
PIOClockat the top of your script. - Use
clock = PIOClock.Clock(<state_machine_id>, <pin_number>)to instantiate a new clock with the provided state machine and pin.- State machine IDs range from 0-7, and each clock will need a unique state machine ID.
- Each clock will also require a unique pin number.
- Set the hertz value of a clock with
clock.set(<hertz>).
This repository includes a testing class. Copy over the PIOClock.py file to a Pi Pico, save ClockTest.py as main.py in the root directory of the Pico, and then you can run it to evaluate the PIO Clock class.