Part 4 Installing the Arduino integrated development environment (IDE) on a PC/Initial Testing
Firstly you will need to install the Arduino IDE on a PC/Laptop so you can upload the code to the Arduino Uno module.
This link http://arduino.cc/en...de/Windows#toc1 will give full instructions on how to install the IDE, connect the Arduino Uno to your PC/Laptop and run a simple program called ‘Blink’ to check that the Arduino is working ok (I’d leave the Adafruit and DCC I/F disconnected at this stage until you’re sure the basic Arduino working ok).
Next you will need to download the Libraries for the Adafruit Stepper Motor Module and the DCC Decoder control.
For the Adafruit Library go to http://learn.adafruit.com/adafruit-motor-shield-v2-for-arduino/install-software and click on the ‘Download latest Adafruit Motor Shield V2 Library’ button.
This will download a zip file ‘Adafruit_Motor_Shield_V2_Library-master.zip’ to a location on your PC.
Browse to this file double click on it and click ‘Extract all files’ giving a new folder Adafruit_Motor_Shield_V2_Library-master.
Change the ‘-‘ to an ‘_’ as Libraries can’t have ‘-‘ signs
Now copy (or move) this folder and its contents to c:\……..\My Documents\Arduino\libraries\
(……… will probably be your user name)
Next we want the DCC Libraries.
Download them from here: http://www.mynabay.com/arduino/2-uncategorised/14-arduino-dcc-monitor
‘DCC-Decoder Library Version 4’
Again extract the files from the zip file and change the ‘.’ In the folder name (dcc_decoder.v4) to a ‘_’ and move the folder to C:\.........My Documents \Arduino\libraries\
You should now have two new folders in c:\……..\My Documents\Arduino\
Now plug the Adafruit onto the Arduino module and connect up the Stepper Motor and Sensor (disconnect Arduino from the power/USB first). You will now need to supply 9-12DC to the Power terminal of the Adafruit module for the Motor supply and reconnect the USB lead from the Arduino to the PC.
Start the Arduino IDE (the same way as for the ‘Blink’ test).
Now browse to the ‘Stepper Test’ sketch from the ‘File’ menu.
And upload the sketch.
This sketch will spin the stepper motor back and forth through 4 different modes of operation.
Single Stepping, Double stepping, Interleaved Stepping and Micro Stepping.
Don’t worry how violent the movement is for this test, just don’t leave a loco on the bridge when you do it. The motion will be a lot smoother with the turntable control sketch.
Next we want to test the DCC interface.
Browse to the DCC_Monitor sketch from the ‘File’ Menu
And upload the sketch.
At this point you need to have your DCC track connected to the DCC interface board and be able to generate some DCC commands, ideally Turnout commands for Accessory Decoder 200. This will depend on your system but generally push buttons to:
Normal (or Reverse)
From the Arduino IDE Window, open up the Serial Monitor by clicking on the small Icon near the top righthand side of the window. This will open up a new window and if all is well you should see some data scrolling up the screen.
Don’t worry if they’re not the same as these, if you’re getting anything it’s probably working.
Now send a few Dcc Accessory commands from your DCC controller.
You should see an extra line of data appear each time.
Again don’t worry if the numbers are not the same as these.
OK, so hopefully we now have the Stepper and DCC Interface working, next test is for the Sensor for the deck reference point.
That will be in Part 5 as I’ve not written any test code for that yet, (it just worked so I didn’t bother) along with a test sketch for setting the speed/acceleration and deceleration and a 180deg turn.
Edited by tender, 18 November 2013 - 16:22 .