GithubHelp home page GithubHelp logo

rmshao / python-for-mbot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xeecos/python-for-mbot

0.0 2.0 0.0 202 KB

A Python interface to control and communicate with mBot robot kit

Home Page: http://www.makeblock.com

License: GNU General Public License v2.0

Python 100.00%

python-for-mbot's Introduction

Python Library for mBot

Table of contents

Description

A Python interface to control and communicate with mBot robot kit from Makeblock

This has been tested with:

  • the Raspberry PI.
  • the Intel Edison.

It works on Linux, Windows 7 and OS X.

Software Dependencies

Prepare for Makeblock's Bots

  1. Download the source from the git https://github.com/Makeblock-official/Makeblock-Libraries

  2. copy the makeblock folder to your arduino default library. Your Arduino library folder should now look like this (on Windows): [arduino installation directory]\libraries\makeblock\src (on MACOS): [arduino Package Contents]\contents\Java\libraries\makeblock\src

  3. Open the Arduino Application. (If it's already open, you will need to restart it to see changes.)

  4. Click "File-> Examples". Here are firmwares for Makeblock's bots in "MakeBlockDrive->Firmware_for_mBlock".

  5. Upload the Firmware to your bot.

Installation

install python 2.7.x ( http://python.org/downloads )

for Windows users: 
  set path x:/Python27 x:/Python27/Scripts
  Install Microsoft Visual C++ Compiler for Python 2.7
  (http://www.microsoft.com/en-us/download/confirmation.aspx?id=44266)
for Macosx users:
  pip install --upgrade setuptools --user python
[sudo] pip install cython
[sudo] pip install pyserial
[sudo] pip install hidapi

Usage

 git clone https://github.com/xeecos/python-for-mbot

Enter the folder "python-for-mbot"

Edit lightsensor.py

from lib.mBot import *

def onLight(value):
    print "light = ",value

if __name__ == '__main__':
    bot = mBot()
    bot.startWithSerial("COM15") or bot.startWithHID()
    while(1):
      bot.requestLightOnBoard(1,onLight)
      sleep(0.5)

using usb serial or bluetooth serial:

change the serial port name "COMX or /dev/tty.XXX" for your mBot on system

bot.startWithSerial("COM15")

using wireless HID:

bot.startWithHID()

running:

[sudo] python lightsensor.py

###Learn more from Makeblock official website http://www.makeblock.com

python-for-mbot's People

Contributors

xeecos avatar makeblock-official avatar

Watchers

James Cloos avatar  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.