Hardware Reference
In-Depth Information
and the lights will begin to dim at 7 P.M. At 7 P.M, the second phase begins; the
Arduino's PWM has 256 possible values. A loop, decreases the value of each of
the color outputs by 1, creating a delay() over 1 hour divided into 256 steps.
Once this hour has passed, the sketch will wait for 11 hours. At 7 A.M, the sketch
will begin to increase the light levels using the looping technique, simulating a
morning sunrise over the course of an hour. The sketch then waits for another
4 hours, until midday. It then repeats the cycle.
Exercises
This application is extremely useful for i sh-keepers, but connecting to the PC
to get temperature information may be an unnecessary process. Also, the tem-
perature warning function is critical, but again, if the computer is not turned
on, the user never receives his warning. This application could benei t from an
LCD screen to be effective—to show the temperature, output status, and any
warning messages.
Turning this application on at exactly midday may not be practical for many
people. A real-time clock module would be a good tool for keeping accurate
timing.
The strip light contains RGB LEDs, and this sketch changes all the colors at
the same rate, resulting in white light. However, in some cases you might not
want white light, but maybe something more green to simulate a more realistic
environment, or maybe leave some blue light on during the night. You can easily
change the sketch to add the color you want.
Summary
In this chapter, you have seen how powerful the Scheduler can be with only
a few instructions. You have seen how an Arduino Due can perform multiple
tasks at the same time, and how to avoid possible problems. In the next chapter,
you will see the USBHost library and how to connect USB input devices to your
Arduino, allowing text and mouse inputs for your sketches.
 
Search WWH ::




Custom Search