Skip to main content

A port of Grove Motor Driver TB6612FNG library for python and RaspberryPI. This library also includes easing functions to control your motors with smooth transitions.Easing functions are available for dc motors only.

Project description

RaspberryPi Grove TB6612FNG Motor Shield Library

PyPI pyversions PyPI version shields.io PyPI license Codacy Badge

This is an open source port of the official Grove Motor Shield TB6612FNG library for Arduino to Python3 on RaspberryPI.

This is a port of Grove Arduino Library for Grove I2C Motor Driver on TB6612FNG.

Features

  • Library is identical to the official Grove
  • It depends only on built in libraries**

**library requires I2C to be activated on the RaspberryPI board running Linux build

Requirements

  • RaspberryPi linux image
  • Python 3.6+
  • smbus library
  • time library
  • math library

This library also includes a experimental python easing functions:

  • Contains 6 easing functions for smooth start of motors
  • Easing functions currently can only be used on a single motor at once
  • Containing IN and OUT functions

How to use

Basic usage of this library is very simple. First make sure you are running the latest released version of pip.

This library requires you to add an additional index-url to pip.conf in order to install it. You can do this by editing your config file with sudo nano /etc/pip.conf and inserting this line just after the [global] section:

index-url=https://pypi.python.org/

Now you can install the package as usual, for python3 use something for example: python3 -m pip install raspberry-i2c-tb6612fng

Next, after successful instalation you can import this library and start using it in your project like this:

# import default libraries that are used in this example
import time

# import the library
from raspberry_i2c_tb6612fng import MotorDriverTB6612FNG, TB6612FNGMotors

# create an instance of the driver, connected to i2c
driver = MotorDriverTB6612FNG()

# drive both motors forward
driver.dc_motor_run(TB6612FNGMotors.MOTOR_CHA, 200)
driver.dc_motor_run(TB6612FNGMotors.MOTOR_CHB, 200)

# pause for a second
time.sleep(1)

# stop the motors
driver.dc_motor_break(TB6612FNGMotors.MOTOR_CHA)
driver.dc_motor_break(TB6612FNGMotors.MOTOR_CHB)
Documentation

If you would like to read about all functions available, please refer to this projects Wiki page on GitHub.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

raspberry-i2c-tb6612fng-0.2.0.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

raspberry_i2c_tb6612fng-0.2.0-py3-none-any.whl (20.6 kB view details)

Uploaded Python 3

File details

Details for the file raspberry-i2c-tb6612fng-0.2.0.tar.gz.

File metadata

  • Download URL: raspberry-i2c-tb6612fng-0.2.0.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for raspberry-i2c-tb6612fng-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0cfceb2e9e80aa455f9dcb5c951e1ccc22bd42da6f23ff4c97d5107c32aa6cc2
MD5 bbff5ebc24041da0dc44dce4ea7cc57f
BLAKE2b-256 328f160d09cd8b96efdff445c41e6377f937ae1b45bc9fba2329484e0664cf9a

See more details on using hashes here.

File details

Details for the file raspberry_i2c_tb6612fng-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: raspberry_i2c_tb6612fng-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.6.1 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for raspberry_i2c_tb6612fng-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a88627646597685c975934e0ad65e014a31732f03cbdb671b62f50e4a4e39d3
MD5 2d4e1f7c8346421bf9c5d85ea0ac3f8b
BLAKE2b-256 ee976d1e882da2ce44927c0994d115159bfe06e3289d27080b5143d0217a60c9

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page