Go Down

Topic: multi LEDs control (Read 119 times) previous topic - next topic

bergstromcarl

Greetings everyone, (Hi again if you answered my first question)

So, thanks to the helpful people of this forum, I have a better understanding of what I want and how to get it. I am able to get the LEDs to cooperate...sort of. I was able to get 3 momentary switch to alternate 3 LEDs to cycle on and off. Now what I need to do is to turn off all the other LEDs when a Button is clicked. i.e Button 1 is pressed turning on LED 1, when Button 2 is pressed LED 1 turns off and LED 2 turns on. Right now I am focusing on getting just the three LEDs to act the way I want before ramping up to the 6 LED strips that I want to use. The sketch does not seem to have any errors, it uploads. However the LEDs just seem to flicker (dim) My guess is that my loop() is faulty. I have attached the code file, thank you ahead of time for any advice/help.

LarryD

#1
Mar 20, 2017, 08:34 pm Last Edit: Mar 20, 2017, 08:36 pm by LarryD
if (zone1Button = HIGH)
Change to
if (zone1Button == HIGH)

Assignment vs comparison

There are more ;)


Code: [Select]
  if (zone3Button = HIGH)
  digitalWrite(zone3, HIGH);
  digitalWrite(zone1, LOW);
  digitalWrite(zone2, LOW);


Did you want
Code: [Select]
  if (zone3Button = HIGH)
{
  digitalWrite(zone3, HIGH);
  digitalWrite(zone1, LOW);
  digitalWrite(zone2, LOW);
}



Use CTRL T to format your code.
.
No technical PMs.
The last thing you did is where you should start looking.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy