Other languages: FRANCAIS
Kitronik-Pico-Motor-Driver-Board-MicroPython
A class and sample code to use the Kitronik Motor driver board for Raspberry Pi Pico. (www.kitronik.co.uk/5331)
This is the MicroPython version. For CircuitPython see here
To use save PicoMotorDriver.py file onto the Pico so it can be imported
Import the library and construct an instance
import PicoMotorDriver
board = PicoMotorDriver.KitronikPicoMotor()
This will setup the correct pins to drive the motors.
Drive a motor:
board.motorOn(motor, direction, speed)
where:
- motor => 1 or 2
- direction => f or r
- speed => 0 to 100
The following example drives the both motors in opposite direction.
import PicoMotorDriver
board = PicoMotorDriver.KitronikPicoMotor()
board.motorOn(1, 'f', 100)
board.motorOn(2, 'r', 50) # turning slower
See also the following example scripts:
- SingleMotorTest.py: Driving one motor at the time (in both direction with speed increase/decrease) script.
- AllMotorTest.py: test various combination of speed for the both motor (like on a 2 wheels robot).
Stop a motor:
board.motorOff(motor)
where:
- motor => 1 or 2
Drive a Stepper:
Rotating in steps
board.step(direction,steps)
where:
- direction => f or r
- steps => how many steps to make
See also the StepperTest.py example script.
Rotating an angle
board.stepAngle(direction, angle)
where
- direction => f or r
- angle => how many degrees to move
Default parameters
The stepper code assumes 200 steps per revolution (1.8 degrees per step) and only does full steps.
There are defaulted parameters for
- stepper speeds: default 20mS pause between steps,
- hold position when finished stepping: off - saves energy
- how many steps per rev: 200. Look at the function headers and function comments in PicoMotorDriver.py for more detail if you need to change them.
Troubleshooting
This code is designed to be used as a module. See: https://kitronik.co.uk/blogs/resources/modules-micro-python-and-the-raspberry-pi-pico for more information
Metadata
Release files for KitronikPicoMotorDriver 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| KitronikPicoMotorDriver-1.0.0.tar.gz | 4.3 kB | Without provenance | Details for KitronikPicoMotorDriver-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| KitronikPicoMotorDriver-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for KitronikPicoMotorDriver-1.0.0-py3-none-any.whl |
Total release size: 8.9 kB
Release files / KitronikPicoMotorDriver-1.0.0.tar.gz
| Download URL | KitronikPicoMotorDriver-1.0.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9a55ad6e0626e309dd81916ce0c72edcb9c05f0f8c553ec94eb65f538db55e3b
|
|
BLAKE2b-256 checksum How to use checksums |
04baa3fb608520d885ce20b9620a1867d228bac751011ddae6f5f591dae9099c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.10
|
Release files / KitronikPicoMotorDriver-1.0.0-py3-none-any.whl
| Download URL | KitronikPicoMotorDriver-1.0.0-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
af2774d907c76ba3cb107e4d801c3d83aa37f6e36b958ebbce3b32c2025cb405
|
|
BLAKE2b-256 checksum How to use checksums |
e8c5e841dae4adef575c986e08b7b96c5a9b79c17d1c463e21bc6c05f3b948b2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.8.10
|
Security for KitronikPicoMotorDriver 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.