One knob controlling two parameters
-
@DanH I'll give you a hint, try checking the value of the button inside the callback ;)
-
@d-healey 2 hours later and I still can't do it! I'm hopeless
-
@DanH
LEG1.setBypassed(value);
-
@d-healey Thank you, I don't understand but thank you! (why no Boolean in there?!)
-
@DanH In the callback you get the parameters
component
andvalue
. Component refers to the control that triggered the callback (in this case the button), and value refers to the value of the control... so the button's value, which will be either1
or0
depending on if the button is on or off. You can putConsole.print(value);
in your callback to see the button's value printed each time you click it, very useful for testing. -
@DanH - why no boolean? Go take a look at one of the introduction to javascript courses - they're usually free - and it will guide you thru the different kinds of variables, booleans are one type - and they "resolve" to true = 1 and false = 0.
So 1 and 0 are numbers and also one of the ways booleans represent themselves - so you can use the value of a button (which is always 1 or 0)
-