For the past two days I have literally lost my patience with Qik 2s9v1 dual serial motor controller. I have referred so many website and I could not make this controller work. After hours of searching I found this library which was compatible with Arduino 1.0. Now I got a library which can used to communicate with the controller but the commands I send was not getting received. I posted in Pololu forum and I didn’t get a reply. Today I joined Sparkfun IRC chatroom and requested for help. @agmlego helped me in resolving the issue. I was using wrong baud rate for serial communication. Once that got the issue resolved I jumped into controlling the motor using a Proximity Sensor.

The mission was to change the motor rotation to reverse if any object is close by.

#include <CompactQik2s9v1.h>
#include <SoftwareSerial.h>
/*
Important Note:
The rxPin goes to the Qik's "TX" pin
The txPin goes to the Qik's "RX" pin
*/
#define rxPin 2
#define txPin 3
#define rstPin 4

#define sensorIR A0
float sensorValue, inches;

SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);
CompactQik2s9v1 motor = CompactQik2s9v1(&mySerial,rstPin);

void setup()  {
  Serial.begin(9600);
  mySerial.begin(38400);
  motor.begin();
  motor.stopBothMotors();
}

void loop() {
  inches = 0;
  for(int i = 0; i < 5; i++){
    sensorValue = analogRead(sensorIR);
    inches = inches + ( 4192.936 * pow(sensorValue,-0.935) - 3.937);
    delay(100);
  }
  inches = inches / 5;
  if(inches < 8.0){
    motor.motor0Reverse(127);
    motor.motor1Reverse(127);
  }else{
    motor.motor0Forward(127);
    motor.motor1Forward(127);
  }
  Serial.print("Inches: ");
  Serial.println(inches);
}

I am really happy with the progress, I hope these reference bellow helps 😉

Reference: Qik Dual Serial Motor Controller, Infrared Proximity Sensor, Micro Metal Gear motor, CompactQik2s9v1, Long Range Infrared

PS: If anyone needs help with the connection please feel free to contact me.