Skip to content
How to turn on and off a light with python ?
Profile icon

What I am trying to code is not (or at least I dont think it is) very hard. I am trying to code a simple program to turn on and off a light. I will later connect it with an Arduino to turn on and off a light with my program. I need the command to control the light/LED, if you know it. I also would like to know how to give a time limit to the lighting time.

If you can help me thank you !

P.S. : I am exactly trying to make a code to make optic morse. I got the code to translate text to morse, but now I need to translate morse code into light signals. Once I will now how to turn on and off a light/LED, I think it will be easier.

You are viewing a single comment. View All
Profile icon

Hi, OP. An interesting thread. I am not a programmer and don’t understand the whole process. I just wanted to ask whether it will be possible to use a similar program to turn on and off led strip light from They look cool in my room and I like them but I wanted to be able to turn them off and on automatically at certain time.
For example, I usually go to bed at 10 pm, and fall asleep around 10:30 pm. Is it possible that the lights turn off themselves at that time that was set by me? I am sorry if it’s a stupid question, I just want to know if it’s possible.