Lab 1 under OS X
For this, I'm assuming you've already installed and have working Python 2.7, pyserial, PyQt4, and the Teensy Loader.
When I started Lab 1, I thought I had everything installed and working. But when I went to use the GUI, it was clear there was still work to do!
I couldn't get my Teensy to show up when I scanned from the GUI. To solve that, I had to modify piano_lab.py.
First, I ran
ls /dev >> ~/Desktop/ls1
then plugged in my Teensy and ran
ls /dev >> ~/Desktop/ls2
and by comparing the two outputs, determined the Teensy is connected (for me) as
I'm unsure whether this will be constant for everyone or not. If adding /dev/cu.usbmodem12341 doesn't work for you, I'd recommend following my above procedure for yourself. You could also attempt
ls /dev | grep "cu.usbmodem"
which assumes the only variance is the number (i.e. 12341). Again, no idea what it's going to be like on other systems! Just a couple things to try.
So, once you've added whatever Teensy is connected as (try "/dev/cu.usbmodem12341" first), your new piano_lab.py should look like so:
# create combo box and button for port settings
self.ports = [ "Port",
'/dev/ttyACM0', '/dev/ttyACM1','/dev/ttyACM2', '/dev/ttyACM3','/dev/ttyACM4', '/dev/ttyACM5',
'/dev/ttyUSB0','/dev/ttyUSB1','/dev/ttyUSB2','/dev/ttyUSB3', '/dev/ttyUSB4', '/dev/ttyUSB5',
'/dev/ttyUSB6', '/dev/ttyUSB7', '/dev/ttyUSB8', '/dev/ttyUSB9', '/dev/ttyUSB10',
'/dev/ttyS0', '/dev/ttyS1', '/dev/ttyS2',
'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', 'com10',
'com11', 'com12', 'com13', 'com14', 'com15', 'com16', 'com17', 'com18',
'com19', 'com20', 'com21', 'com1', '/dev/cu.usbmodem12341']
If Teensy shows up in the drop down box when you 'Scan', we're one step closer!
Next is a much simpler modification.
Just modify these 4 lines to be wrapped in the str() function (like below).
self.ser.write( self.song_array[i].note )
self.ser.write( self.song_array[i].octave )
self.ser.write( self.song_array[i].sharp )
self.ser.write( self.song_array[i].length )
self.ser.write( str(self.song_array[i].note) )
self.ser.write( str(self.song_array[i].octave) )
self.ser.write( str(self.song_array[i].sharp) )
self.ser.write( str(self.song_array[i].length) )
This has to do with pyserial expecting a string to be passed.
Hope it works for everyone else!