Update ofSerial and ofArduino

Part of this is a bug/feature request in ofSerial but the majority has to do with updating ofArduino to work with different hardware. Firmata 2.3 uses hardware abstraction so I thought it was weird that the implementation of ofArduino is specific to the atmega 168/328 chips in the uno etc…

The ofWiring code created by the wiring.org people found here: Wiring’s Openframeworks/Firmata example works on boards with other chips which I have tested on the Teensy 3.0, ++2.0, mega 1280 and 2560 and have had no problems. Can we not just use their code for a newer ofArduino?

As for the bug in ofSerial it has to do with its implementation on windows machines, specifically when building the device list. When you enumerate the ports on win32 it stores the short name into the ofSerialDeviceInfo data type which is just COM3 etc… which would be fine but then the code tries to sort the devices. When it checks isDeviceArduino its looks for the strings usbserial or usbmodem which only happens on OSX. Instead of sending it the short name it would be better to send it the friendly name and then just check for arduino in a similar fashion. I made a function that returns a vector of strings which shows how this is implemented. Though it may be nice to have this as a feature on windows machines so that as you can see below you can differentiate between devices for using firmata and serial simultaneously

vector<string> devices;
vector <ofSerialDeviceInfo> deviceList = serial.getDeviceList();
vector<string> deviceFriendlyName = serial.getDeviceFriendlyNames();
for(int i=0;i<deviceFriendlyName.size();i++){
	if(strstr(deviceFriendlyName[i].c_str(), "Arduino") != NULL){
		cout << "Setting up firmata on " << deviceList[i].getDeviceName() << endl;
		ard.connect(deviceList[i].getDeviceName(), 57600); 
	} 
	if(strstr(deviceFriendlyName[i].c_str(), "Silicon") != NULL){
		cout << "Setting up Serial on " << deviceList[i].getDeviceName() << endl;
		serial.setup(deviceList[i].getDeviceName(), 9600);
	}
}