1

I have been playing with a RPi for a little while now.

I have just got a new DS3231 RTC for it, and I want to use the RPi to turn an LED on at a specific time and have its brightness adjust up every hour then adjust back down every hour until a time where it then turns off.

E.g. on at 5pm, then brighter at 6, brighter at 7 etc.. then at 12 every hour it gets dimmer until 7 when it turns off. The RTC is working and keeping time. I have got a Zero w running noobs, using wiringPi and Python.

Quintin Balsdon
  • 681
  • 5
  • 19
  • 2
    What exactly is your question? – Steve Robillard Jul 31 '17 at 12:18
  • It helps if you give people an idea of what you have tried, so that they can help you appropriately. However it really looks like cronjobs (https://www.raspberrypi.org/documentation/linux/usage/cron.md) is exactly what you are looking for, if you are executing bash scripts – Quintin Balsdon Jul 31 '17 at 15:02
  • I haven't tried anything yet, cause I'm not sure where to start. Thanks I will look into cronjobs – Justin Endress Aug 01 '17 at 08:44

2 Answers2

2

Look into so called: Cronjobs

As an example: 0 8 * * * will execute every day at 8 am

Here you can find almost every Cronjob Usage

Jacobm001
  • 11,898
  • 7
  • 46
  • 56
user5339049
  • 121
  • 1
2

If you have a standard LED and you want to change the brightness then this can be done with pulse width modulation (pwm). As your LED is on all the time it's probably easier to write a python script to check the current time and set the pin frequency based on that? example at: http://www.instructables.com/id/Dim-a-LED-With-Raspberry-Pi-3-and-Python/

The draw back of this approach is the python script has to run for ever. I think some of the neopixels can be set then left? If they can then you set the values every hour with a crontab job, a nice tutorial is here:

https://www.computerhope.com/unix/ucrontab.htm

e.g.

00 * * * * * /path_to/your/script.py

This should run script.py at the start of every hour. This script would check the time and send a new set of value to your neopixel.

Craig

Craig
  • 606
  • 4
  • 14