BInary numbers
-
inline function onbtnQueryControl(component, value) { if (value) { local state = ""; for (i = 0; i < buttons.length; i++) state += Math.round(buttons[i].getValue()); Console.clear(); switch (state) { case "0001": Console.print("Do this"); break; case "0010": Console.print("Do that"); break; case "1011": Console.print("Do whatever"); break; default: Console.print("Do nothing"); } } }
-
@ustk said in BInary numbers:
a state you don't "see"
-
-
@ustk You were right, I found a cleaner way to do it without resorting to bit masks :)
-
@ustk nope, that's even worse, you're creating a string in the button callback and it might reallocate it in each loop iteration :)
-
@christoph-hart then using a reg should resolve the issue right? For a better world? :)
-
Is there a way to use bitwise operators in SNEX?