This tutorial will show how to control individual LEDs on the VMeter using special MIDI commands. A variety of demos are illustrated in the following python script.
note: hardware rev B and firmware 1.28+ required.
Download: VMeter_python_demos.py (more details are in comments in the code).
To run, type "python VMeter_python_demos.py". Note: you will first need to install pyMidiPort if on OS X, and possibly some additional libraries for the CPU monitoring demo (http://code.google.com/p/psutil/). Please see our pyMidiPort tutorial for the harrowing details.
There are 38 LEDs that can be individually addressed by sending "aftertouch" commands over MIDI channels 14, 15 and 16.
To set the first 4 LEDs on, and all other off, send:
0xAD, 0x0F, 0x00
0xAE, 0x00, 0x00
0xAF, 0x00, 0x00
To set every other LED on and off, send:
0xAD, 0b01010101, 0b00101010
0xAE, 0b01010101, 0b00101010
0xAF, 0b01010101, 0b00000010
Note that only the first 3 bits (LSBs) of the 2nd byte of the 3rd command are used.
def SendArray(array, MidiOut): # assuming 38 length array # need to split array into (6) 7bit chunks # Individual LED control is sent to the aftertouch MIDI command and channels 14, 15 and 16. # Each of the data bytes transmit 7 LED states. bytes = [0,0,0,0,0,0] bytes[0] = array[0] | array[1]<<1 | array[2]<<2 | array[3]<<3 | array[4]<<4 | array[5]<<5 | array[6]<<6 bytes[1] = array[7] | array[8]<<1 | array[9]<<2 | array[10]<<3 | array[11]<<4 | array[12]<<5 | array[13]<<6 bytes[2] = array[14] | array[15]<<1 | array[16]<<2 | array[17]<<3 | array[18]<<4 | array[19]<<5 | array[20]<<6 bytes[3] = array[21] | array[22]<<1 | array[23]<<2 | array[24]<<3 | array[25]<<4 | array[26]<<5 | array[27]<<6 bytes[4] = array[28] | array[29]<<1 | array[30]<<2 | array[31]<<3 | array[32]<<4 | array[33]<<5 | array[34]<<6 bytes[5] = array[35] | array[36]<<1 | array[37]<<2 MidiOut.WriteShort(0xAD,bytes[0],bytes[1]) MidiOut.WriteShort(0xAE,bytes[2],bytes[3]) MidiOut.WriteShort(0xAF,bytes[4],bytes[5])