We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpElectronics,  Serial Library › Controlling Servo with Firmata
Page Index Toggle Pages: 1
Controlling Servo with Firmata (Read 2511 times)
Controlling Servo with Firmata
May 27th, 2010, 4:41pm
 
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.  Smiley
Page Index Toggle Pages: 1