Issue
I am very new to using a raspberry PI and was given a ver 3 by a friend. i thought it would be neat as a first project to have it turn off/on the usb ports that then power some lego light sets. All i am looking to do is:
- get the dusk time of were i live
- turn the lights on (turn usb ports on) at dusk.
- turn off the lights at say 2-3 am
- rinse & repeat
bonus if i could login with my phone and turn on/off when i feel like.
any help would be great. i have managed to use uhubctl to be able to urn the lights on/off manually, but not able to figure the rest out to automate it.
any help would be great. thank you
Solution
- To get the time of evening where you live, look at this post Sunrise and Sunset time in Python
2, 3, 4. Disclaimer: I have some (limited) RPi experience. I wouldn't use the usb ports to control LEDs. Instead, follow this guide: https://projects.raspberrypi.org/en/projects/leds-buzzers-scratch-games/1 using the GPIO pins on your RPi. You can follow the next guide on the website to code the GPIO pins using Scratch. There are also lots of guides online regarding Python and LEDs. You can play around with this code and the code from #1 to create what you are looking for. If you need additional help with the code, just comment.
Additionally, follow this guide for remote GPIO control using your phone: https://www.youtube.com/watch?v=lnHyVswZksM
Answered By - Max Answer Checked By - Katrina (WPSolving Volunteer)