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

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

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.0.tar.gz (5.4 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.0-py3-none-any.whl (20.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: raspberry-i2c-tb6612fng-0.1.0.tar.gz
  • Upload date:
  • Size: 5.4 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.0.tar.gz
Algorithm Hash digest
SHA256 0303d8ee84317242c4544626640890db0c8ef1e9014d341ac4623bb0053612c5
MD5 c859ae51515d24a9a43b553145b4bf8c
BLAKE2b-256 07464ef4a2de2dfad774c331e05af97db696b47216be77f5a92f3ba8d2058573

See more details on using hashes here.

File details

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

File metadata

  • Download URL: raspberry_i2c_tb6612fng-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.0 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 92919a243f17e0728577e1b7aeee0bbe7cb68eeab871c174081b1d66a683d84a
MD5 f98e4188e94414907410959e1244a0f1
BLAKE2b-256 476fc89c0b77edc6288ceead126ff25842f4f1d38795892b4c2610b192e533a2

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