Coder Social home page Coder Social logo

spike-tools's Introduction

spike-tools

Utilities for experimenting with Lego Spike Hub

To install dependencies

pip3 install -r requirements.txt

The default device address to communicate with the hub is /dev/ttyACM0 and otherwise can be specified with --tty option. The port path can be discovered with sudo python -m serial.tools.list_ports.

Access to serial ports usually needs a special privilige. To avoid running every command with sudo you can do the follwing in Linux (needs logout to become effective).

sudo adduser <user name> dialout

If the center led of the hub flashes red shortly after connecting and/or you see random characters appearing when manually connecting to the hub via a terminal (something like ATE1 E0 ~x~), this likely indicates a modem controller is trying to talk to the hub (which won't succeed). Under Linux this can be disbled with:

sudo systemctl disable ModemManager

spikejsonrpc.py

A module to communicate with the Spike Hub using JSON RPC. Can be used to manage program slots of the on brick selector.

usage: spikejsonrpc.py [-h] [-t TTY] [--debug]
                       {list,ls,fwinfo,mv,upload,cp,rm,start,stop,display} ...

Tools for Spike Hub RPC protocol

positional arguments:
  {list,ls,fwinfo,mv,upload,cp,rm,start,stop,display}
    list (ls)           List stored programs
    fwinfo              Show firmware version
    mv                  Changes program slot
    upload (cp)         Uploads a program
    rm                  Removes the program at a given slot
    start               Starts a program
    stop                Stop program execution
    display             Displays image on the LED matrix

optional arguments:
  -h, --help            show this help message and exit
  -t TTY, --tty TTY     Spike Hub device path
  --debug               Enable debug

The programs launched with the default launcher need to be expressed in coroutines so they can be exited properly. hub/program_template.py is an example skeleton program handling initialization. It can be uploaded with:

sudo ./spikejsonrpc.py upload hub/program_template.py 19

cp.py

Copy a file to the hub filesystem.

usage: cp.py [-h] [-t TTY] file [dir]

convert_sound.py

Converts a sound file to a format accepted by hub.sound.play() method. Accepts any input format supported by librosa.

usage: convert_sound.py [-h] [-s START] [-d DURATION] file

spike-tools's People

Contributors

nutki avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.