Socket
Socket
Sign inDemoInstall

KitronikPicoRobotics

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

KitronikPicoRobotics

Kitronik Robotics Board for Raspberry Pi Pico to drive 4 motors (or 2 stepper motors) and 8 servos


Maintainers
1

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

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc