If I need to switch on 2 led, instead of 1.. How do you write the statement??
For example: digitalWrite(ledPinUp, HIGH); (and led pin x - HIGH)
Thanks.
If I need to switch on 2 led, instead of 1.. How do you write the statement??
For example: digitalWrite(ledPinUp, HIGH); (and led pin x - HIGH)
Thanks.
If I need to switch on 2 led, instead of 1.. How do you write the statement??
The false assumption in your question is that it can be done with one statement. It can't.
I see.. so you have to write it like?
digitalWrite(ledPinUp, HIGH); digitalWrite(ledPinDown, HIGH);
Assuming ledPinUp is a variable containing the value of one of your digital pins, you would just need another statement which is connected to the other digital pin an led is connected to, and set it to high.
int ledPinUp = 2, ledPinUp = 3; //set this to what digital pins you are using for both the led's
digitalWrite(ledPinUp, HIGH); digitalWrite(ledPinUp2, HIGH); //this will write both pins to their HIGH state
thanks, that is what I required to know.. The format of the statement.
int ledPinUp = 2, ledPinUp = 3; //set this to what digital pins you are using for both the led's
[/quote]
Do you use a comma (after the 2) or an ;
intertronic:
int ledPinUp = 2, ledPinUp = 3; //set this to what digital pins you are using for both the led'sDo you use a comma (after the 2) or an ;
When you're defining multiple variables of the same type on the same line, you can use a comma and skip the second "int" keyword. So yes, use a comma in this case.
Thanks