Hey i have brought two Qik2s9v1 Motor Controller to controll the 4 motors…
I have added newsoftserial library along with Qik2s9v1.
i followed how to connect motor controller…here how i have connected…please advice me if have connected anything wrong.
GND - ARDUINO GROUND
VCC -5 VOLT FROM ARDUINO
TX OF QIK TO PIN 3 ON ARDUINO
RX OF QIL TO PIN 4 ON ARDUINO
RST - PIN 5 ON ARDUINO
M1 - TO MOTOR 1
M0 - TO MOTOR 2
GND - CONNECTED TO GROUND OF 9 V BATTERY I HAVE CONNECTED
VMOT -TO PISIVITE OF 9 V BATTERY …
THAN I HAVE UPLOADED CODE BELOW:
/*************************************************************
- CompactQik2s9v1 - basic class to control Pololu’s Qik2s9v1
- motor controller (pololu.com/catalog/product/1110)
- This uses the default settings for the motor controller and the
- Compact Protocol to communicate to it.
- This library also depends on the NewSoftSerial library which
- can be found at: arduiniana.org.
- Sketch allows for motor control via serial connection to the
- Arduino. PC -> serial -> Arduino -> serial -> Qik2s9v1
*************************************************************/
#include <CompactQik2s9v1.h>
#include <NewSoftSerial.h>
/*
Important Note:
The rxPin goes to the Qik’s “TX” pin
The txPin goes to the Qik’s “RX” pin
*/
#define rxPin 3
#define txPin 4
#define rstPin 5
NewSoftSerial mySerial = NewSoftSerial(rxPin, txPin);
CompactQik2s9v1 motor = CompactQik2s9v1(&mySerial,rstPin);
byte motorSelection;
byte motorSpeed;
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
motor.begin();
motor.stopBothMotors();
}
void loop()
{
if ( Serial.available() > 0 )
{
motorSelection = Serial.read();
switch(motorSelection)
{
case 0:
motor.motor0Forward(getSpeedByte());
break;
case 1:
motor.motor0Reverse(getSpeedByte());
break;
case 2:
motor.motor1Forward(getSpeedByte());
break;
case 3:
motor.motor1Reverse(getSpeedByte());
break;
case 4:
motor.motor0Coast();
break;
case 5:
motor.motor1Coast();
break;
case 6:
motor.stopBothMotors();
break;
default:
showHelp();
break;
}
}
}
byte getSpeedByte()
{
return Serial.read();
}
void showHelp()
{
Serial.println(“Send 1 or 2 bytes: “);
Serial.println(” ()”);
Serial.println(“motor selection choices:”);
Serial.println(“0 - m0 forward”);
Serial.println(“1 - m0 reverse”);
Serial.println(“2 - m1 forward”);
Serial.println(“3 - m1 reverse”);
Serial.println(“4 - m0 coast (no speed byte)”);
Serial.println(“5 - m1 coast (no speed byte)”);
Serial.println(“6 - stop both (no speed byte)”);
}
…
I HAVE ALSO USED ANOTHER CODE WICH IS BELOW…
…
/*************************************************************
- CompactQik2s9v1 - basic class to control Pololu’s Qik2s9v1
- motor controller (pololu.com/catalog/product/1110)
- This uses the default settings for the motor controller and the
- Compact Protocol to communicate to it.
- This library also depends on the NewSoftSerial library which
- can be found at: arduiniana.org.
- This sketch shows the required setup and then tells the
- motors to stop
*************************************************************/
#include <CompactQik2s9v1.h>
#include <NewSoftSerial.h>
#define rxPin 3
#define txPin 4
#define rstPin 5
NewSoftSerial mySerial = NewSoftSerial(rxPin, txPin);
CompactQik2s9v1 motor = CompactQik2s9v1(&mySerial,rstPin);
byte fwVersion = -1;
void setup()
{
mySerial.begin(9600);
motor.begin();
motor.stopBothMotors();
}
void loop()
{
// nothing to do, used to stop the motors
}
…
after doing that my motor is not running at all…
can anyone can tell me what should i do?
is there any problem with wiring that i have shown above…
i am using motor GM8 143:1 Gear Motor brought from pololu…it said compatible with
Qik2s9v1 …
so whats went wrong please help …