Making a light flash on Launchpad MK 2

  • Forum
  • [RESOLVED] Making a light flash on Launchpad MK 2
0
0

Hey there! 

So yesterday I started a project with Launchpad MK2 to make it act like a computer keyboard.

I programmed a button so when I push it, it turns RED and acts like hitting “Esc”.

My question is that maybe is that possible to make it flash for example 3 times with a 500ms delay?

RESOLVED
Marked as spam
Posted by (Forum: 3, Answers: 4)
July 1, 2017 7:46 pm
110 views
0
Private answer

Hi, yes, to do this you will need a timer and some global variables

In the attached example I have 5 translators

1 Start – Happens when opening project triggers init timer which sets global variables

2 Init  – Also triggers Init timer with the escape key to get global variables to a known state if something gets out of whack

3-Start Flashing. Monitors the input for a note on message and triggers a timer that does the work (Flash)

4-This does the actual work

Here are the global variables

// button state
ga=0
//channel
gb=0
//note number
gc=10
//timer count
gd=6

Here is what the timer does

// Toggle button state 1 if on 2 is off
ga=ga^1
// decrement flash counter
gd=gd-1
//Make sure flashes always end with off
if gd==0 then ga=0
if gd==0 then gd=6
if gd==6 then ge=0
// Set note number
pp=gb
// OR note number with note on messsage
pp=pp|144
// On color = Red
if ga==1 then qq=5
//Off color 0 for off
if ga==0 then qq=0

 

As you can see, I’ve set it up to be able to change colors of flashes. For instance with the right values you could hav it flash red and blue or whatever 2 colors you want.

Keep in mind this example is for notes On message only. If you want top keys to work also which use CC messages, you will have to do something similar with them.

Have fun!

Steve

 

bome@sniz.biz

 

Independent Bome Programming Specialist

 

Bome Q&A moderator

 

Marked as spam
Posted by (Forum: 43, Answers: 2876)
July 1, 2017 9:33 pm