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

This text you see here is actually written in Markdown! To get a feel for Markdown's syntax, type some text into the left window and watch the results in the right.

How to use

Basic usage of this library is very simple. First of all 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 successfull 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.1.3.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: raspberry-i2c-tb6612fng-0.1.3.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for raspberry-i2c-tb6612fng-0.1.3.tar.gz
Algorithm Hash digest
SHA256 c4361cfbffcfbbab02eb6c8adb0266bb19ef93ade644fe08eedeba2d11907d8e
MD5 0985277aff8b2488af651e983613c7e1
BLAKE2b-256 cac965337cc8c8d5a7f94de88339604a1df9689becca5e958ced3bcf2ee28876

See more details on using hashes here.

File details

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

File metadata

  • Download URL: raspberry_i2c_tb6612fng-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 20.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for raspberry_i2c_tb6612fng-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 68183d0844f3c8627f3561c4204bd27b6e0666f3124ee7debe13d944617a0957
MD5 368e38163845ac455592950029cb6ed5
BLAKE2b-256 23d73b7c36249b80a242eed1fa4414628c593fe19ed3c63a8636609474fa193d

See more details on using hashes here.

Supported by

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