Hardware Reference
In-Depth Information
Figure 15-2: Project schematic (Image created with Fritzing)
Stepper motors often have different connections, depending on the make and
model. See the documentation that came with your motor to see how to connect it.
Sketch
The sketch is the easy part of the project; this sketch simply reads the temperature
and updates the position of the motor depending on temperature differences.
The sketch is shown in Listing 15-1.
Listing 15-1: Stepper thermometer (fi lename: Chapter15.ino )
1 #include <Stepper.h>
2
3 // Set this to the number of steps your motor needs to make one turn
4 #define STEPS 100
5
6 // Stepper motor is connected to pins 8 to 11
7 Stepper stepper(STEPS, 8, 9, 10, 11);
 
Search WWH ::




Custom Search