feedback to console

jav1985

New Member
hello everyone, these days I am carrying out an idea... to make a console to manage OBS, as you can see in the image I have red buttons to go live a scene, I have yellow buttons to put a scene in preview, I have blue buttons to control the replay, white buttons to mute audio inputs and black buttons that are for transition. I'm using an Arduino and I programmed it as a keyboard, to execute key combinations and thus be able to activate and deactivate scenes.... but, as you will see, I have LEDs that I would like to turn on as feedback from OBS. For this, I am trying to program a python Lua file, I was able to establish a serial communication with my arduino, but I don't know how to do the rest. yes can you guide me please. I am using obs.obs_properties_add_list to be able to display a listbox for each button and thus be able to choose the action for that button.


consola JP OBS.jpeg
 
To have OBS control the LEDs, you just need a Lua or Python script to send a message to the Arduino telling which LEDs to turn on or off.

Take a look at obs_frontend_add_event_callback and https://obsproject.com/docs/reference-frontend-api.html. You can specify a function to be called when any or various events occurs, such as preview/program scene changes, streaming and recording start/stop, etc.

obs_frontend_get_current_preview_scene and obs_frontend_get_current_scene return the current preview and program scenes.

obs_source_muted will tell you whether an audio source is muted or not. I don't see a callback on mute/unmute, so you will probably need to call this periodically; maybe a few times per second.

Message "protocol" can be very simple: a message might be a command byte with bit7=1, followed by zero or more data bytes with bit7=0. the number of data bytes can vary with the command. If the Arduino gets out of sync and sees a byte with bit7=0 when it expects a command, it can just ignore the byte and wait for the next one. Some possible messages:
  • Set Program Scene LED. One data byte follows, to specify which of the 8 LEDs to turn on (the others going off). If you want to be able to turn ALL of the LEDs off, you could use zero to that, and number your scenes 1 through 8
  • Set Preview Scene LED. Same format the above
  • Turn mute LED on. One data byte follows, to specify which LED
  • Turn mute LED off. One data byte follows, to specify which LED
  • etc.
If you wanted to, you could use the bottom 3 or 4 bits of the command byte to specify the LED, and eliminate the data byte. But adding the data byte lets you extend the system, when you decide to build a bigger panel with 400 scenes :)
 

jav1985

New Member
Hello John, thank you very much for your recommendations, I will be posting here the doubts that will continue to appear and I will also publish my progress. I repeat, thank you very much for your time in answering.

Cheers
 
Top