This is an adjusted version of the Python PID controller by ivmech https://github.com/ivmech/ivPID/blob/master/README.md
It is adjusted to make it run on a BBC Microbit board written in MicroPython. Main changes are in the use of the 'time' functions.
The great thing about this implementation is the use of a PID-object, in stead of doing the PID calculations in your Main-loop. This enables more PID controllers at the same time. Great stuff when trying to sync 4 motors in 1 vehicle ;)
You'll find:
- PIDClass.py The PID-object code
- MotorSync.py The main body syncing 2 motors using the accelerometer
- MotorSyncUX.py The main body including the UX for setting the PID parameters interactively
For further explanation please have a look at the YouTube video here: https://youtu.be/fMj4k6QnzZg