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.

3
  • 2
    What exactly is your question? Jul 31, 2017 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 (raspberrypi.org/documentation/linux/usage/cron.md) is exactly what you are looking for, if you are executing bash scripts
    – Quintin B
    Jul 31, 2017 at 15:02
  • I haven't tried anything yet, cause I'm not sure where to start. Thanks I will look into cronjobs Aug 1, 2017 at 8:44

2 Answers 2

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

0
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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.