-
Notifications
You must be signed in to change notification settings - Fork 0
Home
vihaanvp edited this page Jul 3, 2026
·
7 revisions
Version: 1.0.0
Author: Vihaan Parlikar
License: MIT
A unified Python library for Arduino-style DC motor and servo control over Firmata. Wraps pyfirmata2 to give you a simple, Arduino-inspired API.
| Page | Description |
|---|---|
| Board API | Board class, connection, motor management, standby pin |
| Motor API | DC motor control — forward, backward, stop, brake |
| Servo API | Servo control — write, read, smooth movement, sweep |
| Sensor API | VL53L0X time-of-flight distance sensor |
| Utilities |
delay(), millis() helpers |
| Exceptions | Exception hierarchy and catch-all patterns |
| Examples | 11 complete runnable examples |
| Edge Cases & Notes | Behavioural details and gotchas |
# Required dependencies
pip install pyfirmata2 pyserial
# Install MegaWrapper (local / editable)
pip install -e /path/to/MegaWrapper
# Or just point pip at the directory
pip install -e .- Open the Arduino IDE.
- Go to File → Examples → Firmata → StandardFirmata.
- Upload the sketch to your Arduino board.
- Leave the USB cable connected — that's the serial link the library uses.
| OS | Typical port |
|---|---|
| Linux |
/dev/ttyUSB0, /dev/ttyACM0
|
| macOS |
/dev/tty.usbserial-*, /dev/tty.usbmodem*
|
| Windows |
COM3, COM4, etc. |
To find the right port on Windows, open Device Manager and look under Ports (COM & LPT). On Linux/macOS, run ls /dev/tty* before and after plugging in the Arduino and see what appears.
from megawrapper import (
Board, # Arduino connection
Motor, # DC motor (H-bridge)
Servo, # Servo motor
VL53L0X, # Time-of-flight distance sensor
delay, # Pause (ms)
millis, # Epoch time (ms)
MegaWrapperError, # Base exception
InvalidSpeedError, # Speed out of 0-100
BoardConnectionError, # Can't reach Arduino
StandbyNotConfiguredError, # STBY pin not set
__version__, # "1.0.0"
)All public symbols are importable directly from megawrapper:
from megawrapper import Board, Motor, Servo