Source

faux_vox / midi_tester.py

#!/usr/bin/env python
import serial
from arduino import Arduino

def test_midi(a):

  command= "foo"
  a.flush()
  while (ord(command[1]) != 0xf):
    command = a.read(3)
    a.flush()
    print hex(ord(command[0])), hex(ord(command[1])), hex(ord(command[2]))

if __name__ == '__main__':
  # drop to console for test with python -i 
  a = Arduino('/dev/tty.usbmodem24371', 31250)

  command= "foo"

  test_midi(a)
  
  a.send('\xf0\x78\x00\x01\x00\x00\xb1\x02\x63\xb1\x03\x61\xf7')
  test_midi(a)