Firmata example 0071 not working


The firmata example in 0071 doesnt seem to work with a new Arduino UNO on windows. I have successully upload standardFirmata to the board and did a simple LED blink in 0062 but in 007 & 0071 a couple of things dont work

// this event never fires

ofAddListener(ard.EInitialized, this, &testApp::setupArduino);  

i can set it up with the following in update

if(ard.isArduinoReady() && !bSetupArduino){  
	    const int i = 0;  

and in 007 its then possible to fade an LED.

In 0071 the fade works for approx 80 frames and then stops writing bytes. There is a fade in to start and then stops afterv wrting the bytes.

Im on WIn7, C:B, Arduino UNO with 1.01, and arduino 0018
Here’s the full code:

#include "testApp.h"  
void testApp::setup(){  
    buttonState = "digital pin:";  
    potValue = "analog pin:";  
	font.loadFont("franklinGothic.otf", 20);  
    smallFont.loadFont("franklinGothic.otf", 14);  
    // replace the string below with the serial port for your Arduino board  
    // you can get this from the Arduino application or via command line  
    // for OSX, in your terminal type "ls /dev/tty.*" to get a list of serial devices  
	//ard.connect("/dev/tty.usbmodemfd121", 57600);  
	ard.connect("COM8", 57600);  
	// listen for EInitialized notification. this indicates that  
	// the arduino is ready to receive commands and it is safe to  
	// call setupArduino()  
	ofAddListener(ard.EInitialized, this, &testApp::setupArduino);  
	bSetupArduino	= false;	// flag so we setup arduino when its ready, you don't need to touch this :)  
void testApp::update(){  
	if(ard.isArduinoReady() && !bSetupArduino){  
	    const int i = 0;  
void testApp::setupArduino(const int & version) {  
 printf("SETUP ARDUINO \n");  
	// remove listener because we don't need it anymore  
	ofRemoveListener(ard.EInitialized, this, &testApp::setupArduino);  
	// this is where you setup all the pins and pin modes, etc  
	for (int i = 0; i < 13; i++){  
		ard.sendDigitalPinMode(i, ARD_OUTPUT);  
    ard.sendDigitalPinMode(13, ARD_OUTPUT);  
	ard.sendAnalogPinReporting(0, ARD_ANALOG);	// AB: report data  
	ard.sendDigitalPinMode(11, ARD_PWM);		// on diecimelia: 11 pwm?*/  
	bSetupArduino = true;  
void testApp::updateArduino(){  
	if (bSetupArduino) {  
        ard.sendPwm(11, (int)(128 + 128 * sin(ofGetElapsedTimef())));   // pwm...  
        //ard.sendPwm(13, (int)(128 + 128 * sin(ofGetElapsedTimef())));   // pwm...  
        //ard.sendPwm(5, (int)(128 + 128 * sin(ofGetElapsedTimef())));   // pwm...  



I can’t test this with an Uno, but I did test it with an Arduino Nano on Win 7 and it seems fine. Just curious: why are you using Arduino 18 instead of 1.01 (or whatever it is now)? I don’t think the compiler is any different but I do know that some of the usbserial firmware was updated after the 18 release. Calling update() on the Arduino at 60fps does seem a bit weird to me, but it seems to work ok. Any chance you can step through it closely in the debugger and see where it’s going wrong in ofArduino, maybe ofArduino::initPins()?

Thanks for the response,

I am using the latest Arduino release 1.01 (not 0018 as I wrote) and have tried on a different win7 machine with CB. I have also tested with a fresh download of 0071 and the Firmata example (without my mods) which inclues running update every frame (60 fps). I have also tried a different UNO and still the same problems.

If I use the standard firmata example the ard.EInitialized event is never broadcast.
If I manually set up the arduino it now works fine as long as


in setup is commented out. With the log level set is stops writing bytes.


well apart from the log settings issue and event broadcasting I have managed to solve the other problem with the firmata example on the orignal machine by altering the com port the arduino is registered on. I went to device manager, right-clicked the com port it was original registered to (COM8) went to properties, then advanced and changed it COM2 (or which ever is free) and the example runs fine