(WIP) A alternative firmware for the BrickPi+ to improve motor functionality.
-
You won't be able to use Lego sensors with this firmware. (Maybe I'll add them eventually)
-
At the moment you won't be able to use more than 2 motors. (I'll add this feature probably very soon)
-
I just provide a python library.
-
This DOES NOT work on the BrickPi3
-
The motors require less interaction between the BrickPi and the Raspberry Pi. You send the BrickPi a command (eg. speed on motor 1 to 100) and it will execute it until you send the next one.
-
Windows: There is no supported method and I won't change that.
-
macOS: Install the avr toolchain and it should work. (I have not tested it yet)
-
Linux:
- Install the avr toolchain and GNU Make
- Clone the Repo
- Change into the firmware/ directory
- If you are not using a USBtinyISP programmer open firmware/makefile and set $(PROGRAMMER) accordingly
- Connect your programmer to the ICSP port next to the GPIO Pins (You don't have to flash both chips b/c the firmware doesn't support that yet)
- Execute
make
. This should compile and flash the firmware
-
Install python3 setuptools
-
Clone the Repo
-
Change into the library/ directory
-
Install the library sudo python3 setup.py install
-
Import the library
from BrickPiM import BrickPi
-
Initialise the BrickPI
b = BrickPi(timeout=.1)
- timeout: The time to wait for a reaction
-
Change the speed
b.updateSpeed(motor, speed)
- motor: MA = 0; MB = 1
- Speed: any value between 0 and 255
-
Change the direction
b.updateDirection(motor, direction)
- motor: MA = 0; MB = 1
- Direciton: 0 or 1
-
Rotate the selected motor by specified degree and stop b.moveSteps(motor, steps, interrupt=True)
- motor: MA = 0; MB = 1
- steps: Degree to rotate
- interrupt: Specify whether to wait until the motor stops default = True
-
Close the connection and stop the motors b.stop()