Add role and company
Hi! I am just getting in to coding. I love tech and gadgets. I am interested in coding for Arduino and RPi, I hear python is the way to go. I like the possibilities that coding has to offer. I am looking for different learning platforms if anyone has any suggestions? Hopefully, I will be able to pick up some good advice and sound coding knowledge here.
@Phuket2 thanks for the replies! I know I still have tons of reading/learning to do. I’ve been trying to set myself little goals to accomplish. I guess I was just making it more difficult than it is. And it works great with the little bit of code you suggested. Hopefully I’ll get this thing figured out...Thanks so much!
I am trying to make (what I thought) would be fairly simple GUI with a lighting control switch. It's not actually controlling a light. I just want something that prints to the console that the switch is on or off. I'm extremely new to coding and I just can't figure it out. When I run the code the GUI will appear and print the state of the switch (upon loading) but it will not print if the switch is used after that.
#Lighting Control Switch import ui def lightControl(mySwitch): toggle.switch1 = mySwitch switch1 = "Off" or "On" action_On = False print(not action_On) action_Off = (not action_On) print(action_On) if action_On == True: print("Lights On") if action_Off == True: print("Lights Off") v = ui.load_view() v.present('sheet')
I want a switch that indicates to the console that it has been used and whether it is currently on or off.
No errors are printing and the GUI comes up as it should. Just not the result I want.
Again, I'm very new to coding and just trying to learn and figure things out. Any help is appreciated, thanks!