Welcome! Log In Create A New Profile

Advanced

Second fan on D5

Posted by lightningserpent 
Second fan on D5
November 07, 2012 09:51AM
I purchased a "Fan Extender" online that allows a fan to be used on D4 and D5. Running Marlin firmware the fan can be used on D4 as long as the "motherboard == 34". I can turn the fan on and off using M106/M107. Moving the fan to "fan2" and changing the pin assignment to D5 will make the second fan come on using the m codes.

I am trying to get a fan to work on D4 and D5. I have added a pin definition in the pins.h (fan_pin2), and added an ifdef statement for fan_pin2 on the main marlin sketch. I just cannot find where the "fanspeed" gets written to the appropriate pin.

Any advice on how to make this work would be appreciated.
Re: Second fan on D5
November 09, 2012 12:08AM
It's sloppy but it works. I thought I would share with you in case it comes in handy. I gave up trying to do it like the firmware did with "fanspeed" values and went with an "analogWrite" function. I defined FAN_PIN2 in the pins.h file and added the following code to the Marlin sketch:

#if FAN_PIN2 > -1
      case 606: //M606 Fan2 On
      if (code_seen('S')){
        analogWrite(5, constrain(code_value(),0,255));} //D5 is fan_pin2
        else {
          analogWrite(5, 255);}
        break;
      case 607: //M607 Fan2 Off
        analogWrite(5, 0);
        break;
#endif //FAN_PIN2
Sorry, only registered users may post in this forum.

Click here to login