Programming 2 CompactQik2s9v1 motor controllers arduino

i am currently working on a project with he arduino crcuit boards to build a 3 / 4 wheel soccer robot. i have all the sensors running, but i need the motors. i currently have one of the controllers working, and understand the code, which is derived from the library at code.google.com/p/qik2s9v1arduin … p&can=2&q=

My problem is that i am unsure how to program 2 of the drivers in the same arduino sketch. i have one wired up in the standard way, with rx = 4, tx=3 , rst =5. micro chip 2 is set up woth rx = 6 tx = 7 and rst = 8. at current the library i am using does not supprt 2 of the controllers. Each driver is connected up to the 5 v out put n the arduino ( model: duminalov atmega254)with a seperate 9 battery for each controller to provide the required power to run the motors.

I have spent atleast an hour trolling through different sites in aorder to lerne how to modfy this library.

What i would please like, is for someone to be able to tell me where to get a supporting library, how to do it in my current library, or how to make my own.

if u need more information, please ask, and any help is most thankful.

Hello.

What makes you think that library does not support two controllers? I looked at the code briefly, and I don’t see a reason why it wouldn’t support two controllers. Can you post a very simple test program that tells the two controllers to drive one motor forward and tell me what doesn’t work about it? Also, can you explain your wiring (a wiring diagram or a good picture) and what kind of battery you are using? Are you using a nine-volt battery? Nine-volt batteries typically cannot provide enough current to power most motors.

- Ryan

In case you don’t know about being able to instantiate multiple objects of a Class in C++, what I think you would do with the library is something like this:

#define rxPin1 3
#define txPin1 4
#define rstPin1 5

#define rxPin2 6
#define txPin2 7
#define rstPin2 8

NewSoftSerial mySerial1 =  NewSoftSerial(rxPin1, txPin1);
CompactQik2s9v1 motor1 = CompactQik2s9v1(&mySerial1,rstPin1);

NewSoftSerial mySerial2 =  NewSoftSerial(rxPin2, txPin2);
CompactQik2s9v1 motor2 = CompactQik2s9v1(&mySerial2,rstPin2);

void setup()  
{
  Serial.begin(9600);
  mySerial1.begin(9600);
  mySerial2.begin(9600);
  motor1.begin();
  motor1.stopBothMotors();
  motor2.begin();
  motor2.stopBothMotors();
...

I haven’t compiled or tested it, so it might not work exactly as I have it.

- Ryan

Ryan,
i ahve modified the program the tiniest bit, just to move the majority of it out of viod setup, and made a motor move backwards and forwards with both drivers.

Thanks alot you have been a great help in geting this working.
Jake