python for megapi
Project description
# Python For MegaPi
## How To Use
* Compile and upload the Firmware to MegaPi ( https://github.com/Makeblock-Official/FirmwareForMegaPi )
* On your Raspberry Pi,
```
sudo pip install megapi
```
* Insert the initial code for starting MegaPi first.
```
from megapi import *
bot = MegaPi()
bot.start()
```
* python your code
## Python API
* Start
* **MegaPi**()
* **start**()
* GPIO
* **digitalWrite**( pin, level )
* **pwmWrite**( pin, pwm )
* **digitalRead**( pin, **def** onResult )
* **analogRead**( pin, **def** onResult )
* Motion
* DC Motor
* **dcMotorRun**( port, speed )
* Servo Motor
* **servoRun**( port, angle )
* Encoder Motor
* **encoderMotorRun**( port, speed )
* **encoderMotorMove**( port, speed, distance, **def** onFinish )
* **encoderMotorMoveTo**( port, speed, position, **def** onFinish )
* **encoderMotorSetCurPosZero( port )
* **encoderMotorPosition( port, **def** onResult )
* **encoderMotorSpeed( port, **def** onResult )
* Stepper Motor
* **stepperMotorRun**( port, speed )
* **stepperMotorMove**( port, speed, distance, **def** onFinish )
* **stepperMotorMoveTo**( port, speed, position, **def** onFinish )
* **stepperMotorSetCurPosZero( port )
* 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** (port, axis, **def** onResult )
* Compass
* **compassRead** ( **def** onResult )
* 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 )
* Others
* DSLR Shutter
* **shutterOn** ( port )
* **shutterOff** ( port )
* **focusOn** ( port )
* **focusOff** ( port )
## How To Use
* Compile and upload the Firmware to MegaPi ( https://github.com/Makeblock-Official/FirmwareForMegaPi )
* On your Raspberry Pi,
```
sudo pip install megapi
```
* Insert the initial code for starting MegaPi first.
```
from megapi import *
bot = MegaPi()
bot.start()
```
* python your code
## Python API
* Start
* **MegaPi**()
* **start**()
* GPIO
* **digitalWrite**( pin, level )
* **pwmWrite**( pin, pwm )
* **digitalRead**( pin, **def** onResult )
* **analogRead**( pin, **def** onResult )
* Motion
* DC Motor
* **dcMotorRun**( port, speed )
* Servo Motor
* **servoRun**( port, angle )
* Encoder Motor
* **encoderMotorRun**( port, speed )
* **encoderMotorMove**( port, speed, distance, **def** onFinish )
* **encoderMotorMoveTo**( port, speed, position, **def** onFinish )
* **encoderMotorSetCurPosZero( port )
* **encoderMotorPosition( port, **def** onResult )
* **encoderMotorSpeed( port, **def** onResult )
* Stepper Motor
* **stepperMotorRun**( port, speed )
* **stepperMotorMove**( port, speed, distance, **def** onFinish )
* **stepperMotorMoveTo**( port, speed, position, **def** onFinish )
* **stepperMotorSetCurPosZero( port )
* 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** (port, axis, **def** onResult )
* Compass
* **compassRead** ( **def** onResult )
* 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 )
* Others
* DSLR Shutter
* **shutterOn** ( port )
* **shutterOff** ( port )
* **focusOn** ( port )
* **focusOff** ( port )
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
megapi-0.2.2.tar.gz
(4.9 kB
view details)
File details
Details for the file megapi-0.2.2.tar.gz
.
File metadata
- Download URL: megapi-0.2.2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1fce35d153c9038ea1887c2720d2abe74d6c0d15c761d0cb2debfdbc81f014ba |
|
MD5 | 5f608bd4f5e82249015a4382c31e263b |
|
BLAKE2b-256 | a9ff4db9a95b8bcd8c14b6b2f4fe4e4b493c28f7401ea1251a44bda90a1f7d25 |