Controlling Servo with Firmata

We are a working on creating a program where a button input sends data over the internet via Pachube which is received by another Arduino to control a servo.

We have gotten this successfully working using Processing and Servo Firmata in Arduino (i.e. my button push on my Arduino controls my teammates servo attached to his Arduino). Unfortunately, as we need to both send and recieve data from the same Arduino (send button push data and recieve data to control servo), we need to use the Standard Firmata. This however doesn't successfully control the servo causing it to buzz and not respond to the recieved data.

We have experimented trying to adapt the Firmata codes and using just a simpler code for trouble shooting problems as below. When the following code is run on Processing with Servo Firmata it works beautifully but when run with Standard Firmata, it has the same issue and buzzes / doesn't respond properly.

import processing.serial.; import cc.arduino.; Arduino arduino;

int servoPin = 10; // Control pin for servo motor

void setup(){

size (180, 50); arduino = new Arduino(this, Arduino.list()[0]); arduino.pinMode(servoPin, Arduino.OUTPUT); // note - we are setting a digital pin to output }

void draw(){ arduino.analogWrite(servoPin, mouseX); // the servo moves to the horizontal location of the mouse }

If anyone has done anything similar or can think of a solution, any help would be much appreciated from this sleep deprived, caffeine driven group of uni students. :)

You can drive Bitlash + servos on the Arduino with serial commands from Processing. Bitlash is at http://bitlash.net and there's a blog post at http://www.entropymouse.com/blog/blog:bitlash_1.1_and_servo_mayhem with servo code for the Arduino side.

Open the serial port, wait a couple seconds for the Arduino to reset, and send it your command. Wait until the prompt comes back. Capture and parse the return stream if your command returns a numeric value.

One advantage is that you can debug the hardware side using a serial terminal, then automate it with Processing.

Good luck.

-br http://bitlash.net http://entropymouse.com