Timer setup to blink LED

I have created a channel by channel translator and wish to (whilst the translator is running) create a "for next loop?) to infinitely blink one of the buttons on and off until the translator changed.

The [TRACK SELECTION] button resides at 0x33 so:
<CHANNEL No / 90 … 97> 33 xx reads the button press (on APC40), and
<CHANNEL No / 90 … 97> 33 7F (to APC40) will illuminate it
<CHANNEL No / 90 … 97> 33 00 (to APC40) to switch off.

Is it possible to set this blinking into a single translator?

Many thanks,

Hi,
Here is an example.
The Init preset handles normal housekeeping including initializing global variables and the APC40 MKII to mode 2.
The Working preset handles clearing old LED’s and starting the blink timer.
The LED Feedback preset has the Blink Channel Timer

Global variables used

ga=which channel to blink
gb = blink toggle state (0 or 1)
gc = time in milliseconds to blink the target LED.

When the incoming message of 9x 33 7f comes in the value of ga is set to the current MIDI channel x. The LED’s are all cleared and the blink timer starts.

The always repeating blink timer toggles the state of gb and sets the note message to the currently active outgoing MIDI channel ga.

APC40-Blink-2021-07-07.bmtp (2.1 KB)

Steve Caldwell
Bome Customer Care


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

Where does the global var GD come into play? Apologies for ignorance here!

I’m not using gd in this project. Only ga, gb and gc.

Steve Caldwell
Bome Customer Care


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

I see my error. I’d opened an older example of led blinking for a different controller. Sorry!

Works like a charm! Removed the global channel side of things to trigger only on the higher channels, but it works! Thanking you.

My pleasure!

1 Like

Here it is !

Nice!

Steve Caldwell
Bome Customer Care


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

Evening !

I’m taking another look at the above code, and would like to have an alternative version where it blinks two colours utilising two global variables holding their respective colours AND a four colour blink as well.

It is a case of staggering up to 4 timers within one translator or is it going to work best with 4 translators handling each colour variable with a staggered timer?

Many thanks.

Had an epiphany and used the zero (127) to display the second colour without any offsetting of timers.

Hi, the example I posted is just for the channel buttons that only have 2 colors. You can set up a single timer to blink multiple color if you would like. Just set a value to 0-3 and then rules like this

ga=ga+1
if ga==4 then ga=0
// color 1
if ga==0 then pp=12
// color 2
if ga==1 then pp=24
// color 3
if ga==2 then pp =65
// color 4
if ga==3 then pp= 127

// rr is the note number you want to blink
// assuming you are onl the main grid of an APC40 MKII

Outgoing: 90 rr pp

Steve Caldwell
Bome Customer Care


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