hello all,
ive got an arduino uno board using a pololu qik 2s9v1 motor controller, i was hoping that somebody could possibly help fix this code. basically all i need this robot to do is complete a simple track. thanks for any incoming help.
Tom
#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()
{
motorSelection = Serial.read();
motor.motor0Forward(255);
motor.motor1Forward(255);
delay(4000);
motor.motor0Coast();
motor.motor1Coast();
delay(2000);
motor.motor0Reverse(255);
motor.motor1Reverse(255);
delay(4000);
}
//byte getSpeedByte()
//{
// return Serial.read();
//}
//void showHelp()
//{
// Serial.println("Send 1 or 2 bytes: ");
// Serial.println("<motor selection> (<speed>)");
// 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)");
//}