Arduino Software
1. Download the FREE Arduino IDE from the main Arduino website
2. Choose the appropriate OS (ie: Mac, Windows, Linux)
3. Install the application on your computer.
4. Download the Arduino sketch
[box type=”download”]Control spinQ Arduino Code[/box]
5. Connect your Arduino Nano via blue USB cable provided. (make sure you have disconnected VIN cable before connecting USB cable).
6. Open Arduino software.
7. Open the Sketch (program/code).
8. Upload the Sketch.
The wheels and RGB LED will respond as per code. If it does not, check all the jumpers and look at the code listed below.
If the motors spin in the opposite direction you can either switch the jumper or switch pin assignment in the code below.
1 2 3 4 5 6 |
// Pin Outs for Motors. // Please note that if your polarity is different reverse your pins on the Motor Controller. int Left_IN_A = 11; // Left motor control 1 INA connected to pin 11 int Left_IN_B = 10; // Left motor control 2 INB connected to pin 10 int Right_IN_A = 9; // Right motor control 3 INC connected to pin 9 int Right_IN_B = 6; // Right motor control 4 IND connected to pin 6 |
Make sure you stop the motors for short time before re-engaging them with the code :
1 |
stopMotor(); |
Change the Code!
How do you change the colors of RGB LED?
Can you make only 1 wheel spin?
Can you make spinQ turn left and then go forward?
In the next class, we will add a remote control and sensors and study the code in-depth.
Thanks to Karl Wendt for your support.