Difference between revisions of "Blog 11"
Line 12: | Line 12: | ||
So when I start the code I plan it 1 minute in the future. |
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 |
I already made a lamp go on and off in [[blog 02]]. So I am going to use that same set-up for turning on and off the lamp. |
||
Crontab is more manually |
Crontab is more manually |
||
crontab -e |
crontab -e |
||
has to be done to open |
has to be done to open |
||
and have to put this in to make it work |
and have to put this in to make it work: |
||
# mm hh dom mon dow command |
# mm hh dom mon dow command |
||
Line 24: | Line 24: | ||
To read a certain part: |
To read a certain part: |
||
crontab -l |grep |
crontab -l |grep bin/gpio |
||
( with -v you can also the other parts with out bin/gpio appearing. |
|||
For the people who don't understand: |
For the people who don't understand: |
||
*1 Minute 0-59 |
*1 (mm)Minute 0-59 |
||
*2 Hour 0-23 (0 = midnight) |
*2 (hh)Hour 0-23 (0 = midnight) |
||
*3 Day 1-31 |
*3 (dom)Day 1-31 |
||
*4 Month 1-12 |
*4 (mon)Month 1-12 |
||
*5 Weekday 0-6 (0 = Sunday) |
*5 (dow)Weekday 0-6 (0 = Sunday) |
||
So the text from my is now saying: |
So the text from my is now saying: |
||
gpio write 3 1 at 13:19 |
gpio write 3 1 at 13:19 |
||
gpio write 3 0 at 13:20 |
gpio write 3 0 at 13:20 |
||
To manually change it in the command line: |
|||
( 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 |
( 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 |
Revision as of 10:42, 25 September 2015
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 away the lights are still on at night or day in the house. 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 set-up for turning on and off 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 bin/gpio
( with -v you can also the other parts with out bin/gpio appearing.
For the people who don't understand:
- 1 (mm)Minute 0-59
- 2 (hh)Hour 0-23 (0 = midnight)
- 3 (dom)Day 1-31
- 4 (mon)Month 1-12
- 5 (dow)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
To manually change it in the command line:
( 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.)