Hardware Reference
In-Depth Information
for the Servo motor, and 50 degrees Celsius will be an angle of 135 degrees. The
truth is, there is no need to make any calculations; the Arduino will do that for
you using map() , explained in Chapter 4. As a reminder, map() works like this:
result = map(value, fromLow, fromHigh, toLow, toHigh);
This function maps a number from one range to another, and that is exactly
what is in this example: two ranges. Temperature values vary from 0 to 50, and
angles vary from 45 to 135. Therefore, with a single function, the Arduino will
automatically calculate the output to the stepper motor, converting a tempera-
ture range to an angle range.
Schematic
This application uses an Arduino Uno. The LM35 will be connected to analog
pin 0, and the servo will be connected to digital pin 9. The wiring that should
be used is shown in Figure 14-3.
Figure 14-3: Temperature sensor application schematic (Image created with Fritzing)
 
Search WWH ::




Custom Search