We have two QIK 2s12v10’s hooked up to one Arduino (nano v 3.1) running 4 motors. I’m running Arduino IDE 1.4
The Readme for the Arduino library states github.com/pololu/qik-arduino/b … ME.textile [quote]“It uses the compact protocol, not the Pololu protocol, so it cannot be used to control multiple qiks daisy-chained together on the same serial line.”[/quote]
Ok… so we hooked them up on separate pins (6,7,8) and (9,10,11).
Now for some reason ALL calls to get information such as getFirmwareVersion() and getM0CurrentMilliamps() HANG.
This does NOT happen if my code only uses one controller board at a time but if I even only init the second controller board none of the functions that receive data works. Here is the slightly modified version of the demo code that shows it failing. I commented out getFirmawareVersion() because it hangs there but hangs at the first call to getM0CurrentMilliamps() in the for loop.
#include <SoftwareSerial.h>
#include <PololuQik.h>
PololuQik2s12v10 qik(6, 7, 8);
PololuQik2s12v10 right(9,10,11);
void setup()
{
Serial.begin(115200);
Serial.println("qik 2s12v10 dual serial motor controller");
qik.init();
right.init();
Serial.print("Firmware version: ");
// Serial.write(qik.getFirmwareVersion());
Serial.println();
}
void loop()
{
for (int i = 0; i <= 127; i++)
{
qik.setM0Speed(i);
if (abs(i) % 64 == 32)
{
Serial.print("M0 current: ");
Serial.println(qik.getM0CurrentMilliamps());
}
delay(5);
}
for (int i = 127; i >= -127; i--)
{
qik.setM0Speed(i);
if (abs(i) % 64 == 32)
{
Serial.print("M0 current: ");
Serial.println(qik.getM0CurrentMilliamps());
}
delay(5);
}
for (int i = -127; i <= 0; i++)
{
qik.setM0Speed(i);
if (abs(i) % 64 == 32)
{
Serial.print("M0 current: ");
Serial.println(qik.getM0CurrentMilliamps());
}
delay(5);
}
for (int i = 0; i <= 127; i++)
{
qik.setM1Speed(i);
if (abs(i) % 64 == 32)
{
Serial.print("M1 current: ");
Serial.println(qik.getM1CurrentMilliamps());
}
delay(5);
}
for (int i = 127; i >= -127; i--)
{
qik.setM1Speed(i);
if (abs(i) % 64 == 32)
{
Serial.print("M1 current: ");
Serial.println(qik.getM1CurrentMilliamps());
}
delay(5);
}
for (int i = -127; i <= 0; i++)
{
qik.setM1Speed(i);
if (abs(i) % 64 == 32)
{
Serial.print("M1 current: ");
Serial.println(qik.getM1CurrentMilliamps());
}
delay(5);
}
}
My ‘guess’ is that the problem is the SoftwareSerial library that has been in use since Arduino version 1.0. I’ve had a lot of problems with this library and its documented conflicts with the Servo library. Since the QIK library was last updated in May 2011 it was written prior to the new SoftwareSerial library was added into Arduino 1.0