18v15 Pololu Motor Controller - Need Help With Coding PWM

I have this product, I was wondering if you guys new of any sample code that could help me? I've read several times about how higher frequency(?) equates to more power, but I have no idea what that equates to in code? I am reletively new to all of this and I was wondering if anyone knew of any PWM sample code that is also used in the same way, and code that i could use?

Thanks!

I've read several times about how higher frequency(?) equates to more power, but I have no idea what that equates to in code?

Why do you think you need more power?

No. I just have no idea where I could find sample code that can run on this. Do you know of any good sample code that would work with my setup? Thanks!

Try this code (not tested)

/*
 * Pololu High-Power Motor Driver 18v15 test program
 
 Note: The pot is not directly controlling the motor, 
 but the Arduino is getting the value of the pot and 
 using PWM to control the motor speed based off of that value.
 
 */

int pot = 0; // analog A0
int Dir = 3; // Direction input
int motorPin = 11;  // Pulse width modulation input            

void setup()                    // run once, when the sketch starts
{
  Serial.begin(9600);           // set up Serial library at 9600 bps
  pinMode(pot, INPUT); 
  pinMode(Dir, OUTPUT);
  pinMode(motorPin, OUTPUT);
}

int getPot() {
  int v;
  v = analogRead(pot);
  v = map(v, 0, 1023, 0, 255);
  return v;
}

int motorFoward() {
  analogWrite(motorPin, getPot());
  delay(1000);
  digitalWrite(motorPin, LOW);
  delay(1000);
  digitalWrite(Dir, HIGH);
  Serial.println(getPot());
  delay(1000);
}

int motorBackward() {
  analogWrite(motorPin, getPot());
  delay(1000);
  digitalWrite(motorPin, LOW);
  delay(1000);
  digitalWrite(Dir, LOW);
  Serial.println(getPot());
  delay(1000);
}

void loop()                     // run over and over again
{
  motorFoward();
  motorBackward();
}

Thanks! I'll try playing around with this, it looks pretty cool. Could I run this without receiving the value of the 'Pot'? Also, is 'Pot' the value of a potentiameter?
How would you wire this? I have potentiameters that I could conceivably use, but I would like to just be able to use the motor right now.
Thanks

BillHo:
Try this code (not tested)

/*
  • Pololu High-Power Motor Driver 18v15 test program

Note: The pot is not directly controlling the motor,
but the Arduino is getting the value of the pot and
using PWM to control the motor speed based off of that value.

*/

int pot = 0; // analog A0
int Dir = 3; // Direction input
int motorPin = 11;  // Pulse width modulation input

void setup()                    // run once, when the sketch starts
{
 Serial.begin(9600);           // set up Serial library at 9600 bps
 pinMode(pot, INPUT);
 pinMode(Dir, OUTPUT);
 pinMode(motorPin, OUTPUT);
}

int getPot() {
 int v;
 v = analogRead(pot);
 v = map(v, 0, 1023, 0, 255);
 return v;
}

int motorFoward() {
 analogWrite(motorPin, getPot());
 delay(1000);
 digitalWrite(motorPin, LOW);
 delay(1000);
 digitalWrite(Dir, HIGH);
 Serial.println(getPot());
 delay(1000);
}

int motorBackward() {
 analogWrite(motorPin, getPot());
 delay(1000);
 digitalWrite(motorPin, LOW);
 delay(1000);
 digitalWrite(Dir, LOW);
 Serial.println(getPot());
 delay(1000);
}

void loop()                     // run over and over again
{
 motorFoward();
 motorBackward();
}

In the code you kindly shared with me on this thread, I was wondering what you the variables 'Dir' and 'MotorPin' are and how this should be wired? I can see that these two are output wires, but I don't know for sure where they are suppose to go.
This is the controller I am working with

Edit:
I have tried connecting Pin 11 on Arduino with PWM pin on Pololu. I have connected 'DIR' pin to pin 3 on Arduino. The 5V and Ground Pins on the Pololu have been connected to a 5v Power Source and a Ground. THE POT works PERFECTLY.When I turn the knob, different values printout on the screen correspondingly, so it has to be something to do with the Motor wiring.

On the other end of the Motor controller,I have connected a 9V battery into the inputs of the Pololu and a VEX motor into the Pololu 'OutA' and 'OutB'

connecting Pin 11 on Arduino with PWM pin on Pololu. I have connected 'DIR' pin to pin 3 on Arduino.

That is correct connection

On the other end of the Motor controller,I have connected a 9V battery into the inputs of the Pololu and a VEX motor into the Pololu 'OutA' and 'OutB'

Are you said those 9V transistor square battery? it may not have current for your motor.

VEX motor? two wire or three wire?

Two wire, if I touch the ends of the wires directly to the 9v battery, it runs perfectly fine.