Posted December 13, 2020 Hi, I need help figuring out why Switch 3 is being printed no matter what. It does this properly for switch 1 and 2, but continues to print switch 3 as on, when it is off. Here is the picture of my code, sorry it’s not really legible... EDIT: These are generic brand light switches from Walmart for $0.67 a piece, couldn’t resist. They work well too. As Someone with the username “</TheCoder2019_”, my coding skills are atrocious. Here are my specs: Spoiler MSI PRO-VLH H310M Intel Core i3-8100 (Thanks, @Schnoz!) GTX 1060 OC 3GB or Intel UHD 630 16GB (2x8) Cosair Vengeance LPX CL16 - 2400MHz GAMDIAS Argus M1 An old friend of mine - Intel stock cooler (temps through the roof like 60 C under load) Linux Apps you NEED! Spoiler tmux dhcpd git Hi! I love RGB! Who doesn't? Karens that don't have colorful lights on their Facebook page Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 use different variable name fo input_value like input_value1 , input_value2,input_value3 and after the first if statement use elif like this input_value1 if input_value1 == false : whatever input_value2 elif input_value2 == false : whatever input_value3 elif input_value3 == false : whatever if it was useful give it a like btw if your into linux pay a visit here Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 Author 1 minute ago, mahyar said: use different variable name fo input_value like input_value1 , input_value2,input_value3 and after the first if statement use elif like this *snip* Let me try that As Someone with the username “</TheCoder2019_”, my coding skills are atrocious. Here are my specs: Spoiler MSI PRO-VLH H310M Intel Core i3-8100 (Thanks, @Schnoz!) GTX 1060 OC 3GB or Intel UHD 630 16GB (2x8) Cosair Vengeance LPX CL16 - 2400MHz GAMDIAS Argus M1 An old friend of mine - Intel stock cooler (temps through the roof like 60 C under load) Linux Apps you NEED! Spoiler tmux dhcpd git Hi! I love RGB! Who doesn't? Karens that don't have colorful lights on their Facebook page Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 Author Wait... now I am using the RPi.GPIO library, if I use those other variables, it’s now undefined so now what As Someone with the username “</TheCoder2019_”, my coding skills are atrocious. Here are my specs: Spoiler MSI PRO-VLH H310M Intel Core i3-8100 (Thanks, @Schnoz!) GTX 1060 OC 3GB or Intel UHD 630 16GB (2x8) Cosair Vengeance LPX CL16 - 2400MHz GAMDIAS Argus M1 An old friend of mine - Intel stock cooler (temps through the roof like 60 C under load) Linux Apps you NEED! Spoiler tmux dhcpd git Hi! I love RGB! Who doesn't? Karens that don't have colorful lights on their Facebook page Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 1 minute ago, TheCoder2019 said: Wait... now I am using the RPi.GPIO library, if I use those other variables, it’s now undefined so now what just use the output of library directly dont add that input value thingy if it was useful give it a like btw if your into linux pay a visit here Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 Author How do I do that? I’m still kind of learning Python As Someone with the username “</TheCoder2019_”, my coding skills are atrocious. Here are my specs: Spoiler MSI PRO-VLH H310M Intel Core i3-8100 (Thanks, @Schnoz!) GTX 1060 OC 3GB or Intel UHD 630 16GB (2x8) Cosair Vengeance LPX CL16 - 2400MHz GAMDIAS Argus M1 An old friend of mine - Intel stock cooler (temps through the roof like 60 C under load) Linux Apps you NEED! Spoiler tmux dhcpd git Hi! I love RGB! Who doesn't? Karens that don't have colorful lights on their Facebook page Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 Just now, TheCoder2019 said: How do I do that? I’m still kind of learning Python quote me remove input value and use GPIO.input(switchx) if it was useful give it a like btw if your into linux pay a visit here Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 Author Like this? GPIO.input(switchX, HIGH) As Someone with the username “</TheCoder2019_”, my coding skills are atrocious. Here are my specs: Spoiler MSI PRO-VLH H310M Intel Core i3-8100 (Thanks, @Schnoz!) GTX 1060 OC 3GB or Intel UHD 630 16GB (2x8) Cosair Vengeance LPX CL16 - 2400MHz GAMDIAS Argus M1 An old friend of mine - Intel stock cooler (temps through the roof like 60 C under load) Linux Apps you NEED! Spoiler tmux dhcpd git Hi! I love RGB! Who doesn't? Karens that don't have colorful lights on their Facebook page Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 Just now, TheCoder2019 said: Like this? GPIO.input(switchX, HIGH) no if gpio.input(switchx) == false : if it was useful give it a like btw if your into linux pay a visit here Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 Author Just now, mahyar said: no if gpio.input(switchx) == false : I’m gonna try it... I’ll try to be back in 5 mins? As Someone with the username “</TheCoder2019_”, my coding skills are atrocious. Here are my specs: Spoiler MSI PRO-VLH H310M Intel Core i3-8100 (Thanks, @Schnoz!) GTX 1060 OC 3GB or Intel UHD 630 16GB (2x8) Cosair Vengeance LPX CL16 - 2400MHz GAMDIAS Argus M1 An old friend of mine - Intel stock cooler (temps through the roof like 60 C under load) Linux Apps you NEED! Spoiler tmux dhcpd git Hi! I love RGB! Who doesn't? Karens that don't have colorful lights on their Facebook page Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 Just now, TheCoder2019 said: I’m gonna try it... I’ll try to be back in 5 mins? btw use elif as i showed above if it was useful give it a like btw if your into linux pay a visit here Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 Author Just now, mahyar said: btw use elif as i showed above OK As Someone with the username “</TheCoder2019_”, my coding skills are atrocious. Here are my specs: Spoiler MSI PRO-VLH H310M Intel Core i3-8100 (Thanks, @Schnoz!) GTX 1060 OC 3GB or Intel UHD 630 16GB (2x8) Cosair Vengeance LPX CL16 - 2400MHz GAMDIAS Argus M1 An old friend of mine - Intel stock cooler (temps through the roof like 60 C under load) Linux Apps you NEED! Spoiler tmux dhcpd git Hi! I love RGB! Who doesn't? Karens that don't have colorful lights on their Facebook page Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 Author So I did elif statements and the terminal is still getting spammed by saying switch 3 is on Is this code correct? As Someone with the username “</TheCoder2019_”, my coding skills are atrocious. Here are my specs: Spoiler MSI PRO-VLH H310M Intel Core i3-8100 (Thanks, @Schnoz!) GTX 1060 OC 3GB or Intel UHD 630 16GB (2x8) Cosair Vengeance LPX CL16 - 2400MHz GAMDIAS Argus M1 An old friend of mine - Intel stock cooler (temps through the roof like 60 C under load) Linux Apps you NEED! Spoiler tmux dhcpd git Hi! I love RGB! Who doesn't? Karens that don't have colorful lights on their Facebook page Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 1 minute ago, TheCoder2019 said: So I did elif statements and the terminal is still getting spammed by saying switch 3 is on Is this code correct? well idk much more i usually code this sort of stuff c/c++ those were only things i could see wrong with your code if it was useful give it a like btw if your into linux pay a visit here Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 Author I DID notice when I switched Switch 3 to True, it would stop, but the light switch is now inverted which will annoy me. Anything there? As Someone with the username “</TheCoder2019_”, my coding skills are atrocious. Here are my specs: Spoiler MSI PRO-VLH H310M Intel Core i3-8100 (Thanks, @Schnoz!) GTX 1060 OC 3GB or Intel UHD 630 16GB (2x8) Cosair Vengeance LPX CL16 - 2400MHz GAMDIAS Argus M1 An old friend of mine - Intel stock cooler (temps through the roof like 60 C under load) Linux Apps you NEED! Spoiler tmux dhcpd git Hi! I love RGB! Who doesn't? Karens that don't have colorful lights on their Facebook page Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 5 minutes ago, TheCoder2019 said: I DID notice when I switched Switch 3 to True, it would stop, but the light switch is now inverted which will annoy me. Anything there? wait are you sure that led you are using is good? did you use pullup resistors? how are switches wired? if it was useful give it a like btw if your into linux pay a visit here Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 Author Let me draw it. This may take a while As Someone with the username “</TheCoder2019_”, my coding skills are atrocious. Here are my specs: Spoiler MSI PRO-VLH H310M Intel Core i3-8100 (Thanks, @Schnoz!) GTX 1060 OC 3GB or Intel UHD 630 16GB (2x8) Cosair Vengeance LPX CL16 - 2400MHz GAMDIAS Argus M1 An old friend of mine - Intel stock cooler (temps through the roof like 60 C under load) Linux Apps you NEED! Spoiler tmux dhcpd git Hi! I love RGB! Who doesn't? Karens that don't have colorful lights on their Facebook page Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 Author @mahyar K. Here it is. I am not using pullup resistors because they worked fine without, with no bouncing As Someone with the username “</TheCoder2019_”, my coding skills are atrocious. Here are my specs: Spoiler MSI PRO-VLH H310M Intel Core i3-8100 (Thanks, @Schnoz!) GTX 1060 OC 3GB or Intel UHD 630 16GB (2x8) Cosair Vengeance LPX CL16 - 2400MHz GAMDIAS Argus M1 An old friend of mine - Intel stock cooler (temps through the roof like 60 C under load) Linux Apps you NEED! Spoiler tmux dhcpd git Hi! I love RGB! Who doesn't? Karens that don't have colorful lights on their Facebook page Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 2 minutes ago, TheCoder2019 said: @mahyar K. Here it is. I am not using pullup resistors because they worked fine without, with no bouncing rpi has internal pullup resistors enablee them if it was useful give it a like btw if your into linux pay a visit here Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 Author How? sudo raspi-config? Or another bash command? As Someone with the username “</TheCoder2019_”, my coding skills are atrocious. Here are my specs: Spoiler MSI PRO-VLH H310M Intel Core i3-8100 (Thanks, @Schnoz!) GTX 1060 OC 3GB or Intel UHD 630 16GB (2x8) Cosair Vengeance LPX CL16 - 2400MHz GAMDIAS Argus M1 An old friend of mine - Intel stock cooler (temps through the roof like 60 C under load) Linux Apps you NEED! Spoiler tmux dhcpd git Hi! I love RGB! Who doesn't? Karens that don't have colorful lights on their Facebook page Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 1 minute ago, TheCoder2019 said: How? sudo raspi-config? Or another bash command? none you have to do it in python google it if it was useful give it a like btw if your into linux pay a visit here Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 Author Most of what I find is in Java. Do you mind sourcing the code for me? Sorry for being a pain, I’ll follow for your troubles with me As Someone with the username “</TheCoder2019_”, my coding skills are atrocious. Here are my specs: Spoiler MSI PRO-VLH H310M Intel Core i3-8100 (Thanks, @Schnoz!) GTX 1060 OC 3GB or Intel UHD 630 16GB (2x8) Cosair Vengeance LPX CL16 - 2400MHz GAMDIAS Argus M1 An old friend of mine - Intel stock cooler (temps through the roof like 60 C under load) Linux Apps you NEED! Spoiler tmux dhcpd git Hi! I love RGB! Who doesn't? Karens that don't have colorful lights on their Facebook page Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 1 minute ago, TheCoder2019 said: Most of what I find is in Java. Do you mind sourcing the code for me? Sorry for being a pain, I’ll follow for your troubles with me ok if it was useful give it a like btw if your into linux pay a visit here Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 read this carefully https://raspi.tv/2013/rpi-gpio-basics-6-using-inputs-and-outputs-together-with-rpi-gpio-pull-ups-and-pull-downs if it was useful give it a like btw if your into linux pay a visit here Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Posted December 13, 2020 Author That’s literally what I’ve just read 5 mins ago. It works well, no repeated echo. I would call this thread a success. Thank you for sticking around the 1 hour and 30 some minutes you did As Someone with the username “</TheCoder2019_”, my coding skills are atrocious. Here are my specs: Spoiler MSI PRO-VLH H310M Intel Core i3-8100 (Thanks, @Schnoz!) GTX 1060 OC 3GB or Intel UHD 630 16GB (2x8) Cosair Vengeance LPX CL16 - 2400MHz GAMDIAS Argus M1 An old friend of mine - Intel stock cooler (temps through the roof like 60 C under load) Linux Apps you NEED! Spoiler tmux dhcpd git Hi! I love RGB! Who doesn't? Karens that don't have colorful lights on their Facebook page Link to comment Share on other sites More sharing options... Link to post Share on other sites More sharing options...
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now