Advanced PWM signalling.

Hey, thanks for the question, as best as I can figure, the default PWM analog out frequency is as you say the +- 490Hz, however once I invoke the registers that kinda gets shot to pieces and everything is based on the external clock. I did revise my article though, so once again, thanks.

The frequency chosen to control the motors in our case is more the frequency chosen to control the pololu motor controller boards. In this case they'll take a max of 40KHz, the higher you push the more amps they draw from our experience. I haven't investigated the motor controllers enough to know exactly whats going on in there. We tried to build our own but had problems with the PMOS chips constantly... exploding in our faces.

I also stumbled on something I failed to explain in the last code block, the code now reads:

void loop() {


 dutycycle = analogRead(0);

 //Here, you want to take your period and divide by 1024 
 to find what  scalar you need to multiply your duty cycle 
 in our case it was close enough that we didn't need a 
 multiplier here for testing purposes but your mileage 
 may vary.

 dutycycle = dutycycle;

 analogWrite(PWM3,dutycycle);
 digitalWrite(DIRECTION3,dir);

 //From here down, were changing the direction every 5000
 loops and printing the direction for debug purposes.

 if(count==5000){
   dir = (dir+1)%2;
   count = 0;
 }

 count++;

 Serial.print(dir);
 Serial.print('\n');


}