Pages: [1]   Go Down
Author Topic: Need help getting servo and fan to work at the same time...  (Read 508 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 360
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 360
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1]   Go Up
Jump to: