Flashing LED on Midi In Message

I’m having no luck scrpting a LED widget to flash when a Midi In Block receives a message. I can get it to turn on, but can’t get it to auto turn off. Any ideas?

Could you have a look at this gig file which contains a script that should help you:

MIDI channels activity script

Tell me if it helped.

Semantic error: Line 29, Col 27: Type ST_RampGenerator not allowed here

It should compile and work perfectly with GP 3.6. Do you have the last version of GP?

1 Like

I do now :slight_smile: thanks

1 Like

You do what?

I do now have the latest version. I did not have it before. Its working now. I just need to strip the script down so its less specific on midi channels. thanks though

OK, let me know if something is unclear and if you some more help…

Please remove everything related to the Ramp Array as well as the loop which doesn’t iterate anymore :wink:

I did that and then it didnt work as well…

I just loaded the gig and it is working with 3.6.0 - no issue

OK, ok, I’ll do it for you, but modifying a script is a nice exercise :wink:

Here is the gigfile with the script: MIDI_activity_LED.gig (7.2 KB)

And here is the script:

Var
    MIDI_Activity   : MidiInBlock
    MIDI_LED        : Widget
    MIDI_Heart_Beat : Ramp 

Initialization 
    MIDI_Heart_Beat.SetGeneratorOneShot(True);
    MIDI_Heart_Beat.SetGeneratorLength(19);
    MIDI_Heart_Beat.SetGeneratorCoarseness(10);             
End

On Activate
    SetTimersRunning(true);
    MIDI_LED.SetWidgetValue(0.0);   	
End

On MidiEvent(msg : MidiMessage) from MIDI_Activity
    MIDI_Heart_Beat.EnableGenerator(False);
    MIDI_LED.SetWidgetValue(100.0);    
    MIDI_Heart_Beat.EnableGenerator(True);        
End

On TimePassing(time : integer, magnitude : double) from MIDI_Heart_Beat
    MIDI_LED.SetWidgetValue(0.0);
End
1 Like

Thanks David, much appreciated but unnecessary as I did learn a few things modifying the script. Now to test which one works better :slight_smile: Cheers

Home made is always better, keep yours. The most important thing is that you learned something :wink:

Yeah, I learned how little I know and understand about GP script language and how little in the way of beginner tutorials there are. :frowning:

Do you have any experience in other programming languages?
I am asking because GP script is very easy to use - when you already know other languages.
But if you are an absolute beginner it is like learning to swim - in the beginning it is not easy.
We all can try to help you, just write down your requirement and we will try to help you.

basic arduino and C but I guess not enough to see the comparisons and syntax… the array types i dont get.