Getting Started with the SwitecX25 Library
For Arduino IDE version 1.0 and later you can store user-contributed libraries in a subdirectory of your sketch directory named ‘libraries’. In fact you really should install them there to ensure that they persist when you upgrade the IDE.
So figure out where your project directory is (under OSX this is available in the Arduino -> Preferences
menu), create a subdirectory called libraries
with the project directory. The name is important, so use exactly that. Then inside that libraries directory checkout the SwitecX25 library. You should end up with this structure: 1
2
3
4
5
6
libraries
|
+-- SwitecX25
|
+-- SwitecX25.cpp
SwitecX25.h
There is also an examples directory under that, but those two files are the critical parts of the library.
Restart the IDE and you should see the library in your Sketch -> Import Library
menu. It appears in a separate section at the bottom marked contributed
. Now start a new sketch. Here’s a minimum Hello World sketch for the Switec X25 that runs the motor against the zero stop then moves the motor to the center of its range.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
|
I’ve added this little sketch to the library as an example, so it will appear as File -> Examples -> SwitecX25 -> center
.