Hey guys I’m having a similar problem, hopefully you can help.
With the motor power disconnected, I just get 2 red lights, they stay on, but not motion…(cause there are no batteries this makes sense)
with the motor batteries hooked up, I get a quick flicker of two red lights, the motors hiccup… and then nothing.
I think the problem is the directions are confusing me, everything is in hex… when we go to the important bytes(config, or motor num, and direction) the explanation is in bits… but no example of the bits… the examples are back in hex, or decimal, not in bits…I’m even more confused as to why the bits are represented with zero on the right, or why the first motor is referred to as motor 1, instead of motor 0…
anyway here is my pin setup for the controller
1 positive terminal for 2 AA batteies(3v for motors)
2 ground
3 5v(same as ardunio power, or should this go to 9v/vcc?)
4 to pin 11 my serial tx pin
5 to pin 12, to reset controller
6 motor1 pos
7 motor1 gnd
8 motor2 gnd
9 motor2 pos
of course the battery pack goes to the same ground as everything else on the arduino, and I put a .1uf disk cap between the motor terminals as shown in the manual
#include <SoftwareSerial.h>
byte motorRxPin = 10;//unused
byte motorTxPin = 11;
byte resetPin = 12;
unsigned char buff[4];
SoftwareSerial motorSerial = SoftwareSerial(motorRxPin, motorTxPin);
void setup() {
pinMode(motorTxPin, OUTPUT);
pinMode(motorRxPin, INPUT);
pinMode(resetPin, OUTPUT);
motorSerial.begin(9600);
delay(5000);
buff[0]=0x80;//start byte
buff[1]=0x02;//config command type byte
buff[2]=00000000;//Motor number and direction byte, I want this on motor 3 and 4, 2 motor mode, I don't know how
for(int i=0;i<3;i++){
motorSerial.print(buff[i],BYTE);
}
Serial.println("sent config");
digitalWrite(resetPin, LOW); // reset motor controller
delay(200);
digitalWrite(resetPin, HIGH);
Serial.println("reset controller");
}
void loop() {
buff[0]=0x80;//start byte
buff[1]=0x00;//Device type byte
buff[2]=0x00;//Motor number and direction byte, I want motor 3, forward
buff[3]=0x64;// Motor speed "0 to 128" (100 is 64 in hex)
//send data for motor0
for(int i=0;i<4;i++){
motorSerial.print(buff[i],BYTE);
}
//send data for motor1
buff[1]=0x01; //Motor number and direction byte, I want motor 4, reverse
for(int i=0;i<4;i++) {
motorSerial.print(buff[i],BYTE);
}
delay(5000); // Wait 5 sec then resend data
}
I know it must be the encoding, because I was able to get an L293D to work in like a half an hour, both directions 512 speeds in either direction… but with a lot of pins…