Hardware Reference
In-Depth Information
Engage thrusters
1. PowerSwitch Tail 2's datasheet ( http://www.adafruit.com/datasheets/
PST%20II%20product%20insert.pdf ) provides a schemaic descripion of the
internal circuitry of PowerSwitch Tail 2.
PowerSwitch Tail 2 is connected to Raspberry Pi as shown in the following
figure. The in+ terminal of the switch is connected to the GPIO #17 of
Raspberry Pi, while the in- terminal is connected to the ground pin of
Raspberry Pi.
PowerSwitch Tail 2's interface to Raspberry Pi
The power cord to the lighting equipment needs to be connected to
PowerSwitch Tail 2.
It is assumed that you are familiar with some minor rewiring
to connect indoor/outdoor lighting appliances. Prior training
is required to handle such electrical hardware. If you are
not familiar with handling rewiring, it is best to connect an
off-the-shelf electrical appliance.
2.
Let's review the code for an example where the lights need to be turned on between
5:30 p.m. and 10:45 p.m. everyday.
We get started by creating Unix timestamps for the start and end times
(Unix timestamps refers to the time elapsed since January 1, 1970 in
seconds. More information is available at http://en.wikipedia.org/
wi ki/Unix_time ):
#Get current time
now = datetime.datetime.now()
 
Search WWH ::




Custom Search