m-lundberg / simple-pid

A simple and easy to use PID controller in Python
MIT License
792 stars 216 forks source link

Time module / micropython running on Pi Pico #67

Closed tuemar closed 2 years ago

tuemar commented 2 years ago

The PID controller works since #63 on micropython/pi pico. The only problem is that pi pico only delivers seconds as int when calling time.time(). So the minimum sample rate is 1 second. I solved the problem, but since I'm new to git, I was not able to Pull request. The file where the changes were made is attached. pid.txt

m-lundberg commented 2 years ago

Hi! Thanks for the feedback. This should be fixed by #68 which is now merged. This allows you to set which time function you want the PID to use like this for example:

import time
pid = PID()
pid.time_fn = time.ticks_us
# Use pid as normal