Need help debugging

hello, i am trying to work on a recode for my Christmas light code, and i would like to be able to activate and deactivate some lights at will. I basically would like to be able to select how many lights are in action at once for an action. I am not sure how to do this, and i thought of using booleans, and if statements sort of like
'''if(boolean1 = true){
digitalWrite(5, HIGH);
delay(500);
if(boolean2 == true){
digitalWrite(4, HIGH);
digitalWrite(5, LOW);
}'''
i am just wondering if i could do something like this, but what would happen if i had boolean 1 false, and how would i make it skip that step and go to the second if. thanks for any suggestions.

Please post your full sketch using code tags when you do

This is not a good start :woozy_face:

if(boolean1 = true){

= is not the same as ==

if(boolean1 == true){ <———<<<<use this


Generic questions don’t tell us much.

In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.

Use the </> icon from the ‘reply menu’ to attach the copied sketch.

Presumably, using 'else if'.

You should post the sketch that you have as a code-section
and write in normal words what kind of functionality you would like to have.
Even for the most experienced softwaredevelopper the starting point is a normal-word-description of the wanted funcrionality

best regards Stefan

1 Like

ok, i think i will try using the else if. thanks!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.