This tutorial teaches you how to control VEX motors with a Wii Nunchuk.
It can be very convenient when you want to control your robot with an Arduino and not a VEX cortex and controller.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Materials
- Arduino UNO
- Wii Nunchuk
- Wireless Microcontroller
Step 2: Step 1: Connect Your Wireless Microcontroller
You need to wire your wireless microcontroller to your arduino.
You need to make sure that when you plug in your arduino, the wireless microcontroller begins to flash a blue light.
Once you have your wires connected, make sure to sync the wii nunchuk....
if you do not sync it, there is now way to control it..
Step 3: Step 2: Program and Test
Make sure to create a source code program using an I2C system that allows wireless interaction between the arduino and the wii nunchuk...
In this case, a source code will need to be created. It needs to return the joystick, accelerometer, and button values of the wii nunchuk.
Make sure that you are getting values in the serial monitor (found on the top right corner).
Set the value to 19200.
Step 4: Step 3: Separate Program - Motors
On a new file in Arduino,
Create a program to control the motors.
Test out the program.
Step 5: Step 4: Add to the Source Code
Since the wireless system now works,
You can simply add the motor controlling program into the source code.
However, you can not copy and paste. You need to implement it. So make sure everything is in the right loop, in the right void, and so forth. Also, add if statements to determine the values you need for the joystick to move it forward, backwards, right, and left.
Step 6: Step 5: Joystick Values
In order to make if statements, you need to understand the values - you need a threshhold.
Therefore, when you played around with the source code serial monitor, you need to move the joystick forward, back and furthermore. Write down all the joystick values that appear.
Use them for the motor controlling values.
Step 7: Step 6: Get Rid of USB
To get rid of the direct connection of the USB to the computer, you can attach a battery - you probably should.... or you would be circling the robot with your laptop... which is silly.
If your program is already compiled, then just turn on your nunchuk, and sync it!
Step 8: You're Done!
Enjoy driving! :D