Motor is missing commands
Posted: Fri Jun 24, 2022 2:42 pm
I have
Roboclaw 2x7a V5C
Arduino Nano Every
Adafruit Bluefruit UART Friend
The Robo claw is connected via software serial (38400 BAUD) as well as the BT module on a second software serial connection (9600 BUAD, I think). The device I am working on is supposed to be able to go back and forth with the Motor. Right now, we are having issues where commands seem to only get through to the motor at random. This function is supposed to find a "home" point, where the arm driven by the motor is fully retracted.
I then can execute the
over and over until the motor finally stops. Sometimes it stops on the first try, sometimes it takes 15 tries.
Why are these commands missing? Some members of my team think it could be that the 3 Serial connections on the arduino board interfering with each other. I personally cannot find a pattern anywhere, sometimes the status light blinks when a command is sent and the motor continues to run, sometimes it blinks and the motor stops.This device used to work before we implemented the BT module (previously Xbee with HWSerial) but I can't see the reason why the BT module would be interfering. Thank you for your time.
Roboclaw 2x7a V5C
Arduino Nano Every
Adafruit Bluefruit UART Friend
The Robo claw is connected via software serial (38400 BAUD) as well as the BT module on a second software serial connection (9600 BUAD, I think). The device I am working on is supposed to be able to go back and forth with the Motor. Right now, we are having issues where commands seem to only get through to the motor at random. This function is supposed to find a "home" point, where the arm driven by the motor is fully retracted.
Code: Select all
// Home SMURF and reset encoder values to zero
void home_encoder(){
int enc_last = 0;
int enc_now = 1;
while (enc_last != enc_now){
enc_last = enc_now;
roboclaw.BackwardM1(0x80,100); // moves foot up //always runs fine, starts the motor, no problem
delay(100);
roboclaw.ReadEncoders(address,enc1,enc2); // can use encoders for error detection
enc_now = enc1;
Serial.print("enc_now =");Serial.println(enc_now); //currently the device is deconstructed
Serial.print("enc_last =");Serial.println(enc_last); //these match on the first or second run
//through the loop and break
}//while (enc_last != enc_now)
roboclaw.ResetEncoders(address);
roboclaw.BackwardM1(0x80,0); // stops foot //misses consistently, stops the motor once in a blue moon
}//home_encoder()
Code: Select all
roboclaw.BackwardM1(0x80,0);
Why are these commands missing? Some members of my team think it could be that the 3 Serial connections on the arduino board interfering with each other. I personally cannot find a pattern anywhere, sometimes the status light blinks when a command is sent and the motor continues to run, sometimes it blinks and the motor stops.This device used to work before we implemented the BT module (previously Xbee with HWSerial) but I can't see the reason why the BT module would be interfering. Thank you for your time.