Go Down

Topic: Need help getting servo and fan to work at the same time... (Read 912 times) previous topic - next topic


Extremely newby question here...I'm using this tutorial http://itp.nyu.edu/physcomp/Tutorials/HighCurrentLoads to control a small dc fan.  It works great using either digitalWrite() or analogWrite().
Next I wanted to add a small servo to the project. So I used the servo library example and got it working no problem. But when I try to run both the servo and fan in the same project the fan will only work with digitalWrite(HIGH/LOW) or analogWrite(0/255). It won't run any intermediate rates with analogWrite(). Can someone point me in the right direction to learn why this isn't working and what it will take to accomplish my goal of having both the servo and fan working in the same project? Thanks very much.
- Dean


The Servo library uses the Timer that generates the PWM output for your fan, so it becomes restricted to binary digital output. You can solve this competition for hardware resources by picking a different PWM pin to run the fan from (The first 8 or so servos will use the same Timer, so there's not much point moving that).


Wow 2.5 min response, Aeturnalus you are awesome. I moved the fan PWM pin and both are working now. Thank you!


No problem--feel free to ask questions at any time.

Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131