Skip to main content

No project description provided

Project description

robotserial

robotserial is a library that transmits robot sensor and actuator information through serial ports. It supports USBs as well as any other port that supports serial data transmission. Multiple serial ports may be used at once.

Table of Contents

  1. Example
  2. Installation
  3. License

Example

This will print all values from an attached accelerometer for one second:

from robotserial import SerialStateMachineThread
import time

def print_accelerometer(a, b, c):
    print( "accelerometer xyz: [{}, {}, {}]".format(a,b,c))

ssmt = SerialStateMachineThread()
ssmt.start() # accelerometer currently needs to be found before it can be accessed

ssmt.accelerometer.set_callback( print_accelerometer )

time.sleep(1)
ssmt.join()

The corresponding code to send the data from an Arduino is currently:

Serial.write("I");
Serial.write("\na");
Serial.write(aX.bytes, 4);Serial.write(aY.bytes, 4);Serial.write(aZ.bytes, 4);
Serial.write("\ng");
Serial.write(gX.bytes, 4);Serial.write(gY.bytes, 4);Serial.write(gZ.bytes, 4);
Serial.write("\nm");
Serial.write(mX.bytes, 4);Serial.write(mY.bytes, 4);Serial.write(mZ.bytes, 4);
Serial.write("\n");

This will change once a C/C++ library is made for embedded devices.

Installation

$ pip install robotserial

robotserial is distributed on PyPI as a universal wheel and is available on Linux/macOS and Windows and supports Python 2.7/3.5+ and PyPy.

License

robotserial is distributed under the terms of both

at your option.

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

robotserial-0.0.2.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

robotserial-0.0.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file robotserial-0.0.2.tar.gz.

File metadata

  • Download URL: robotserial-0.0.2.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for robotserial-0.0.2.tar.gz
Algorithm Hash digest
SHA256 bdd2e2c6720f9856b1787d536f50a2f8cc64db27b53d1e057430fdf8f2dd7038
MD5 b412757377d8252bd20b5eda1eebbdda
BLAKE2b-256 ec99cf078420e499fbe2fff05e561b958aa3f5c6f78554d1a03240ba42c72b30

See more details on using hashes here.

File details

Details for the file robotserial-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for robotserial-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6699c0b7aa5bfe334fcfd636f39aa8d5942211cba9435ca94861567fb38db972
MD5 c7b4275f36fb130ba33d07df7556a8bb
BLAKE2b-256 d55a0ba4adefc29f44b94c5471a15713b57c6a12b26dea445f7d57b93d54530e

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