This is a port of the PythonForMegaPi Python librari to work with Me Auriga
- http://www.stuffaboutcode.com/2012/10/raspberry-pi-python-installing-modules.html
- python setup.py install
- Download the Arduino library for Makeblock https://github.com/Makeblock-official/Makeblock-Libraries/archive/master.zip
- Copy the makeblock folder to your arduino default library. Your Arduino library folder should now look like this
- (on Windows):
[x:\Users\XXX\Documents]\Arduino\libraries\makeblock\src
- (on Mac OSX):
[\Users\XXX\Documents]\Arduino\libraries\makeblock\src
- (on Windows):
- Open Arduino IDE, choose the firmware from File>Examples. ** Use the Firmware_For_Auriga
- Compile and upload firmware according to your board type.
- On your Raspberry Pi, disable the login prompt from Desktop->Menu->Preferences->Raspberry Pi Configuration.
- install python library for Makeblock
sudo pip install megapi
- the initial code for python.
from megapi import *
bot = MegaPi()
bot.start() #if using usb cable, need to call bot.start('/dev/ttyACM0')
- python your code
-
Start
- MeAuriga()
- start()
-
GPIO
- digitalWrite( pin, level )
- pwmWrite( pin, pwm )
- digitalRead( pin, def onResult )
- analogRead( pin, def onResult )
-
Motion
- DC Motor
- motorRun( port, speed )
- motorMove( leftspeed, rightspeed )
- Servo Motor
- servoRun( port, slot, angle )
- Encoder Motor
- encoderMotorRun( port, speed )
- encoderMotorMove( port, speed, distance, def onFinish )
- encoderMotorMoveTo( port, speed, position, def onFinish )
- Stepper Motor
- stepperMotorSetting( port, microsteps, acceleration )
- stepperMotorRun( port, speed )
- stepperMotorMove( port, speed, distance, def onFinish )
- stepperMotorMoveTo( port, speed, position, def onFinish )
- DC Motor
-
Sensors
- Ultrasonic Sensor
- ultrasonicSensorRead ( port, def onResult )
- LineFollow Sensor
- lineFollowerRead ( port, def onResult )
- Light Sensor
- lightSensorRead ( port, def onResult )
- Sound Sensor
- soundSensorRead ( port, def onResult )
- Temperature Sensor
- temperatureRead ( port, def onResult )
- PIR Motion Sensor
- pirMotionSensorRead ( port, def onResult )
- Touch Sensor
- touchSensorRead ( port, def onResult )
- LimitSwitch
- limitSwitchRead ( port, slot, def onResult )
- Humiture Sensor
- humitureSensorRead ( port, type, def onResult )
- Gas Sensor
- gasSensorRead ( port, def onResult )
- Flame Sensor
- flameSensorRead ( port, def onResult )
- Button
- buttonRead ( port, def onResult )
- Potentiometer
- potentiometerRead ( port, def onResult )
- Joystick
- joystickRead ( port, axis, def onResult )
- 3-Axis Accelerometer and Gyro Sensor
- gyroRead ( axis, def onResult )
- Compass
- compassRead ( def onResult )
- Pressure Sensor for BMP085 and BMP180
- pressureSensorBegin ( )
- pressureSensorRead ( type, def onResult ) #1:Pressure #2:Temperature #3:Altitude #4:Real altitude #5:Sealevel Pressure
- Ultrasonic Sensor
-
Display
- RGB Led
- rgbLedSetColor ( port, slot, index, r, g, b )
- rgbLedShow ( port, slot )
- rgbLedDisplay ( port, slot, index, r, g, b )
- 7-segment Display
- sevenSegmentDisplay ( port, value )
- Led Matrix Display
- ledMatrixDisplayMessage ( port, x, y, msg )
- ledMatrixDisplayRaw ( port, buffer )
- Serial LCD Display
- lcdDisplay ( string )
- RGB Led
-
Others
- DSLR Shutter
- shutterOn ( port )
- shutterOff ( port )
- focusOn ( port )
- focusOff ( port )
- DSLR Shutter
###Learn more from Makeblock official website: www.makeblock.com