Giter Club home page Giter Club logo

mindstorms-rc-ble-robot-scipts's Introduction

MINDSTORMS Python Remote control over BLE

This repository contains python scripts that go with the free MINDSTORMS Remote BLE App. The Android App is written using http://kodular.io.

MINDSTORMS RC

Usage

To use the scripts copy and paste them into a new Python project inside a LEGO app. You can use either the MINDSTORMS Robot Inventor App or the SPIKE Prime app.

Demo script demo_rc_SPIKE.py

The script demo_rc_SPIKE.py is a demo script that shows the following features:

  • showing text on the status line of the RC
  • making sound when left trigger is activated
  • using the text-to-speech feature
  • showing animations in the LCD 5x5 area on the RC
  • setting the left and right sliders to a specific value
  • use left thumb for steering, right thumb for accelration

Example script hot_rod_rc.py

Example script that can be used with the Robot Invertor Hot Rot. See the the blog abot using the RC on Antons Mindstorms website.

Release notes/Bugs/bugfixes

Android

  • version 1.3: buttons are not correctly encoded
  • version 2: fixed button encoding, changed github reference in help page.

Todo

  • Refactor the script, it's not pretty but it works.
  • Add more comments
  • Expand the documentation
  • Add more examples for different robots.
  • Create a library you can import on the LEGO hubs, so the scripts become even cleaner

Protocol

Sending

The remote control sends its control data in a structure:

bytes format specification range
1 b l_stick_hor -100..100
1 b l_stick_ver -100..100
1 b r_stick_hor -100..100
1 b r_stick_ver -100..100
1 B l_trigger 0..200
1 B r_trigger 0..200
2 h l_slider -360..360
2 h r_slider -360..360
1 B button bits 1 << (button-1)

This corresponds to the following Python structure:

Transmit struct.pack('bbbbBBhhB', l_stick_hor,l_stick_ver,r_stick_hor,r_stick_ver,l_trigger,r_trigger,l_slider,r_slider,buttons)

Receiving

The remote control receives a number of messages using the following structure:

command description example
Image displays a SPIKE/Mindstorms image on small LCD display Image('35790:00000:00000:00000:00000')
T<text> displays test <text> in the status line of the LCD display THello World
S<text> Uses text-to-speech (english) to convert <text> to speech SWall detected
L<value> Sets left slider on value <value> L100
R<value> Sets rightt slider on value <value> R100

Authors

Anton's Mindstorms and Ste7an

mindstorms-rc-ble-robot-scipts's People

Contributors

ste7anste7an avatar antonvh 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.