Blog 11

From BitWizard Wiki
Revision as of 09:12, 25 September 2015 by Cartridge1987 (talk | contribs) (Created page with " == CHARLEY BETA! == == Clock based On/off system == My new system I am going to make is a system that on special times turns light on or off. I want to use this as some a...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

CHARLEY BETA!

Clock based On/off system

My new system I am going to make is a system that on special times turns light on or off. I want to use this as some anti-criminal system. So, that when I am on vacation still the lights are on at night or day. So the house doesn't look like a house that is asking for crackers or criminals.

For this system I am of course going to try it with shorter times otherwise I have to wait 8 hours for a lamp to get on or off.

So when I start the code I plan it 1 minute in the future.

I already made a lamp go on and off in blog 02. so I am going to use that same technique for turning on and of the lamp.

Crontab is more manually

Crontab -e 

has to be done to open and have to put this in to make it work

#  mm hh dom mon dow command 
19 13 * * * /usr/local/bin/gpio write 3 1 
20 13 * * * /usr/local/bin/gpio write 3 0 

To read a certain part:

crontab -l |grep -v bin/gpio 

For the people who don't understand:

  • 1 Minute 0-59
  • 2 Hour 0-23 (0 = midnight)
  • 3 Day 1-31
  • 4 Month 1-12
  • 5 Weekday 0-6 (0 = Sunday)

So the text from my is now saying:

gpio write 3 1 at 13:19
gpio write 3 0 at 13:20
( echo "#  mm hh dom mon dow command" ; echo '19 13 * * * /usr/local/bin/gpio write 3 1' ;  echo '20 13 * * * /usr/local/bin/gpio write 3 0' ) |  crontab 

( You can of course also use it as alarm clock, then you only have to change the command to the location of the audio file you want to play.)

manual Display Alarm