MegaPi的Python编程

 

如何使用:

Prepare for Arduino

下载Makeblock的Arduino库文件  https://github.com/Makeblock-official/Makeblock-Libraries/archive/master.zip

复制Makeblock文件夹到Arduino默认库文件夹。Arduino文件夹如下:

  • (On Windows): [x:\Users\XXX\Documents]\Arduino\libraries\makeblock\src
  • (On Mac OSX): [\Users\XXX\Documents]\Arduino\libraries\makeblock\src

打开 Arduino IDE,从 File>Examples 中选取固件。

firmware

根据你的主控板类型编译和上传相应的固件。

Prepare for Raspberry Pi

在Raspberry Pi上根据以下指令阻止登录命令: Desktop->Menu->Preferences->Raspberry Pi Configuration.

serial

安装Makeblock的Python库文件

sudo pip install megapi

Python的最初指令:

from megapi import *
bot = MegaPi()
bot.start() #if using usb cable, need to call bot.start('/dev/ttyACM0')

python your.py

接线

使用 MegaPi

megapi

使用Me Shield for Raspberry Pi和RJ25数据线连接Me Orion或者Me Baseboard

baseboard-pi-shield

使用USB数据线连接Me Orion或者Me Baseboard

baseboard-usb-cable

查看源代码请点击 https://github.com/Makeblock-official/PythonForMegaPi

Skills

Posted on

2016-04-08