Bug - harcoded DIR pin for cytron driver in PID.ino

Hi Brian,

The DIR pin number is hardcoded in the PID.ino at line 32 and 35 for the Cytron driver.

I would suggest to use:

if (pwmDrive >= 0) bitSet(PORTD, DIR1_RL_ENABLE);  //set the correct direction
else   
{
  bitClear(PORTD, DIR1_RL_ENABLE); 
  pwmDrive = -1 * pwmDrive;  
}

instead of :

if (pwmDrive >= 0) bitSet(PORTD, 4);  //set the correct direction
else   
{
  bitClear(PORTD, 4);
  pwmDrive = -1 * pwmDrive;  
}
1 Like

Ohhhhhh, I’m a little slow lol, or maybe a lot slow. I get what you mean. Gawd, embarrassing… This was brought up in another thread, and it blew right past me.

Yes makes perfect sense all written out like you did. Shall do.