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 › Servo and PWM with processing
Page Index Toggle Pages: 1
Servo and PWM with processing (Read 3474 times)
Servo and PWM with processing
Apr 27th, 2009, 12:04am
 
I have some problem, to get a servo to do what I want in Processing. I get it to work with the servo library in Arduino, but not in Processing.
To clarify this is a software (and understanding) problem. The servo moves actually, it does something in Processing, but I seem not to be able to control it. I used the pwm inputs. Anybody got any code to control servos ? I would like some example, because I seem to just have a major knot in my brain. It is at the moment just one servo on one pwm port. I would like just to be able to put it in zero position, half position and full position. Haven't found anything in the forum or with google.
Re: Servo and PWM with processing
Reply #1 - Sep 5th, 2009, 10:44pm
 
I am interested in this too. Have you heard from anyone?

Anybody know the answer?

I have used Arduino running firmata and Processing sketches with the Arduino library to read and write to the analog and digital pins, but AFAIK the library does not support PWM.
Re: Servo and PWM with processing
Reply #2 - Oct 2nd, 2009, 5:27am
 
Not sure if this addresses your specific problem with PWM control, but I developed a Processing to Arduino control system which allows you to type P:123 in Processing (the 123 being the duty cycle or analogWrite() value used by the Arduino) and send it via the RS232 serial port to the Arduino Tx and Rx pins. (Haven't tackled USB yet)

The code running on the Arduino then sorts out what it's supposed to do with the incoming data - The P is the indicator for an incoming PWM command and the code basically reads the ASCII '1','2' & '3' converts it into an integer which can then be passed into an analogWrite(123) command to actually operate the servo.

Happy to provide/edit the code if you think it might be of any interest or use to you. My intention in writing it was to provide a means of tweaking the Arduino PWM routines without having to reprogram it every time a minor change was made.

The original idea was to make the tweaks and mistakes for the various sweep and search routines I was developing; in Processing and simply leave the Arduino set up to respond to a variety of incoming commands, direct PWM control among them.

Might be worth a look, I'll post the code in the next day or so as I cannot access it from my current location.
Re: Servo and PWM with processing
Reply #3 - Oct 2nd, 2009, 8:02am
 
i know this is off-topic, but doesn't anyone know why I can;t change anything from my profile panel  Undecided
_____________________________________
http://mycoverthypnosis.com
Re: Servo and PWM with processing
Reply #4 - Oct 15th, 2009, 12:54pm
 
I'm with the same problem, please help! Undecided
Page Index Toggle Pages: 1