Skip to main content

Other Languages: FRANCAIS

Kitronik-Pico-Robotics-Board-MicroPython

Pico Robotics Board de KitroniK

A class and sample code to use the Kitronik Robotics board for Raspberry Pi Pico. (www.kitronik.co.uk/5329)

This is the microPython version. For CircuitPython see: https://github.com/KitronikLtd/Kitronik-Pico-Robotics-Board-CircuitPython

To use save PicoRobotics.py file onto the Pico so it can be imported

Import the library and construct an instance:

import PicoRobotics
board = PicoRobotics.KitronikPicoRobotics()

This will initialise the PCA to default values.

Drive a motor:

board.motorOn(motor, direction, speed)

where:

  • motor => 1 to 4
  • direction => f or r
  • speed => 0 to 100

Stop a motor:

board.motorOff(motor)

where:

  • motor => 1 to 4

Drive a Servo:

board.servoWrite(servo, degrees)

where:

  • servo => 1 to 8
  • degrees => 0-180

Drive a Stepper:

board.step(stepperMotor,direction,steps)

where:

  • stepperMotor => 1 or 2 (stepper 1 is DC motors 1 and 2, stepper 2 is DC motors 3 and 4)
  • direction => f or r
  • steps => how many steps to make

To step an angle:

board.stepAngle(stepperMotor, direction, angle)

where

  • stepperMotor => 1 or 2 (stepper 1 is DC motors 1 and 2, stepper 2 is DC motors 3 and 4)
  • direction => f or r
  • angle => how many degrees to move

The stepper code assumes 200 steps per rev (1.8 degrees resolution) 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) and how many steps per rev (200). Look at the function headers and function comments in PicoRobotics.py for more detail if you need to change them.

Troubleshooting

If the code is run without the Pico Robotics board connected, or if the board is not powered up it islikely that it will throw an OS Error (usually OS Error 5). This is because it tries to communicate with an I2C device which is not responding.

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 KitronikPicoRobotics 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for KitronikPicoRobotics 1.0.0
File Size Uploaded
KitronikPicoRobotics-1.0.0.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for KitronikPicoRobotics 1.0.0
File Interpreter ABI Platform
KitronikPicoRobotics-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 kB

Release files / KitronikPicoRobotics-1.0.0.tar.gz

Download URL KitronikPicoRobotics-1.0.0.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
cb0336c72c6e896ea091fe3e076d6fe469c865fd596f6b4a2f450db740dee562
BLAKE2b-256 checksum
How to use checksums
5a1ceff6826fb0365f330a5e1aafb9397d84ef247db3ec3133525f85ee10b585
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release files / KitronikPicoRobotics-1.0.0-py3-none-any.whl

Download URL KitronikPicoRobotics-1.0.0-py3-none-any.whl
Size 5.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64b4681d49ef60439776c6747f4fcbe953a350682c79fa3a8eb4e0187fc5c28a
BLAKE2b-256 checksum
How to use checksums
6a87c9cd9619d007c8bb1b01cc08ab638c1b34d72d8ddad523704d1e4408d090
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page