Go Down

Topic: RGB & Servo Sliders via Python (Read 1 time) previous topic - next topic


Hi Guys,

I'm just getting started on the whole Arduino thing and I've hit a wall. I've modified code found here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1267104041
What I am hoping for is to have 3 sliders for R, G & B, and a fourth that controls the servo.

The setup is fairly simple: pin 9, 10 and 11 are R, G and B respectively. Pin 3 is the servo.

The problem in a nutshell:
If I comment out: "servoMain.attach(servoPin);", the RGB sliders work fine.
If i leave this code in, the servo slider works fine and the B slider works fine, but the others play up.
(Moving them simply switches them to full value of that colour, and on the R slider, it also is sending some weirdness to the servo)

If anyone has any pointers, or any pointers in general about my approach and why it's flawed, please, I'd love to hear them.

Kind Regards,





There are a number of timers available on the Arduino. Servos and PWM both use timers.

One thing that you do NOT need to do is use a PWM for the servo pin.

Try connecting the LEDs to 3, 5, and 6, and the servo to some non-PWM pin.
The art of getting good answers lies in asking good questions.


Thanks heaps!

I gave that a shot and i'm still not having any luck... You're right though, I don't need to be using a PWM pin for the servo... thats a good start


pastebin is blocked for me. Please attach you code to a post directly.

Attaching one servo disables PWM on two pins. So, there should still be 4 PWM pins available. 9 and 10 are the first to go. So, 3. 5. 6. and 11 should still function.
The art of getting good answers lies in asking good questions.


ahh look at you! you're awesome!
that was the trick... :D

so going forward, is there anything like that i need to know? what are the maximum number of servos I can attach/how to i scale this to deal with 3 servos? 10?

Go Up