Controlling DC Motors via serial with Max using Adafruit Motor Shield V2 on an compatible Arduino
This code was initially designed for the Sphéro-Automaton (as seen in the video at the top of this page), in 2014. It uses multiple Adafruit Motor Shield V2 controlled by Max via serial.
In 2015, documentation and sharable Max/MSP patch development was funded by le Cirque du Soleil.
- Download the code here.
It contains some Arduino code and Max patches.
- Make sure your Arduino is one that is compatible with the shield.
- Stack your Adafruit Motor Shield V2 on your Arduino.
- Connect your DC motors and the adequat power supply to your shield.
- Download Arduino IDE, if you do not have it already.
- Install Adafruit Motor Shield V2 library
- Plug your Arduino board to your computer.
- Open the .ino file you need for your project (multiple stacked motor shields or only one shield) in
musinou_DCMotorsSerialControl/Arduino/
- In Arduino IDE Tools menu, under Board, choose your board
- Optional: in void setup() you will find 2 test runs. You can choose whether you want them to run or not by boolean run = true; or boolean run = false;.
-
In Arduino IDE Tools File, choose upload
- Wait until it says "Done uploading."
- Open the basic patch Max for a first test.
musinou_DCMotorsSerialControl/Max/_basic
- Follow the instructions in that patch.
-
Optional:
Open musinou_DCMotorsSerialControl/Max/_basic_motorControl.maxpat as an example of how to limit your motors.