3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Wii Nunchuk Controlled Model Train

Step 4Just the Start!

Just the Start!
«
  • screen2.gif
  • screen3.gif
With the Arduino connected to your computer, compile and upload the sketch.  Again, I'll leave you to Arduino's website to get all that sorted out.

With the sketch uploaded, hit the "Serial Monitor" button in the right-hand corner of the "environment".  This will let you look at what is going on under the hood, so to speak.

The initial part is just the preliminaries.   It assume the nunchuk is plugged and centered.  It will also show you the current speedLimit (out of 255), and stallSpeed, which is the lowest setting at which the engine will move.  It will depend on your engine and power supply. You can easily change any of these in the "environment" and reload the sketch.

Once you hit the joystick, the monitor will begin to stream variables that will tell you what is going on.  throttle is based on the X joystick position with centered = 0 and ranging from about -100 to 100.  speedSet is the setting it is trying to reach, and curSpeed is the current setting (out of 255) supplied to the track. 

Operator's Manual (Ken's Version):
 - Left & right on joystick will move the train in the direction moved.  If your engine moves opposite to the way you want, swap wires to track (easier) or change variables FORWARD and BACKWARD in sketch (harder).  I guess that is where you find out if you are a hardware or software person!
 -  When the joystick centered, the train will slowly coast down based on a variable called "drag".
 - Z-button applies the brakes.
 - C-button is "cruise control".  It will light LED 13 on board and hold train at current speed.  You can speed up, or hit the brake to disengage it.

That is it.  Make it yours.  HACK AWAY.  Use the accelerometer!  Please write some better "firmware"  and share it. 

I hope that if nothing else, this inspires you to get an Arduino and explore the possibilities!  Let me know what you come up with! 

Move on to the last step ONLY IF THE TRAIN STUFF INTERESTS YOU.
« Previous StepDownload PDFView All StepsNext Step »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
14
Followers
8
Author:aspro648