# 3 press button

hi again guys im a bit stuck again
and it will probably happen a couple of more times
ok
i was trying something like this
ie=ie^2
if ie==1 then pp=17
if ie==2 then pp=5
if ie==0 then pp=2

if ie>2 then ie=2
if ie<0 then ie=0

but it seems like i missed some thing.
its for led controll i want to use for clip launch in obs studio so when zero=blue then pulsing green when pressed then red as its launching.
then in obs its a direct midi so there its all working one press arms scene Second launches the scene
later it will be apart of a 5 clip aray so if i arm 1 but shange my mind arm a noter one this one resets to 0 and i will be able to be running one clip arm a nother one but when the armed one get launched the previous running one get resets to 0 so this was the star of that set .

Hi,
The ^ operator is an exclusive or operator so

ie=ie^2

would just toggle bit 2 of the global variable ie. If zero it would change the value to 2 and if 2, it would change the value back to 0.

If you need more than 2 LED colors, then you will need to manage the color value by more bits.
With 2 bits you could set up to 4 colors. With 3 bits, up to 8 colors, with 4 bits up to 16 colors.

So if you need to set 3 colors you need to decide on the color you want to send for each push and have the global variable rotate between 3 states

// initially ie=0
// Increment value
ie=ie+1
// If greater than 2 go back to zero
if ie>2 then ie=0
// Now determine the color the LED understands
if ie==0 the pp=12 (assuming 12 if blue)
if ie==1 then qq=23 (assumining 23 is pulsing green)
if ie==2 then qq=15 (assuming 15 is red)
// Now the output of qq is the value you want to send back to the controller
// pp is the note value
90 pp qq

The above would be for controller LED feedback only. You would need different translators to handle what OBS sees on each press. My guess is that OBS will only see either an on or off (2 states).

As far as a 5 clip array, you would need translators to reset the LED status of the other LED’s each time you switch so that only one LED is activated at a given time.

Steve

thank you
would it work with if ie>2 then ie=2
and yes obs got its midi settings so one midi arms then one more press
will execute
and obs dont have a reset scene
function it resets when next scene is armed

Well
if ie>2 the ie=2

would keep you stuck on 2 all of the time if you are incrementing on each button push.
The way I understood was.
0=original state
1st push
1=arm
2nd push
2=execute
3rd push
0 = back to original state

The above is for button colors only. I’m not sure how you would handled OBS maybe
0= Original State
First Push
1 = Change button color but don’t send to OBS
Second Push
2 - Send Note On to OBS to Execute
Third Push
0 - Send Note ON to OBS to take it back to idle (original state)

Actually I don’t see the value of state 1 other than changing the color of the controller LED, unless there is a different note that you send to OBS to arm/and disarm the execute state.

Steve Caldwell
Bome Customer Care

Also available for paid consulting services: bome@sniz.biz

hi i was going to write 3 state button idle arm fire
i just realised now i wrote 3 press button
0 state is same as non active
state 1 is arm fist press
state 2 is fire second press

and thats it since obs don’t have a back out of arm so thats why i want it to stay armed until next button is pressed if i don’t implament a zero scene in to the line up so third press activate a non altered scene thats on a totally separate note and can the be used by all buttons as reset thank u for that ide
awsome

Not sure what you mean but glad I could help!

Steve

sorry forgot to press solution button