Hello. Just an FYI, I’ve got all of the code and instruments functioning. I’ve got an MPU6050 and a stepper motor that I’m integrating together. If the MPU6050 gives me any negative Roll value, I make the stepper motor run one direction and if it gives me a positive Roll value, the motor runs the other direction. I have a tolerance deadband of 0.03.
The stepper motor is being used as a linear actuator. I downloaded the standard “stepper_oneStepAtATime” code and added a couple of switches so I could run the motor one direction to get my min and max values. When I set this up to a 38400 baud, it ran SO smoothly up and down. It hummed and you could barely hear it.
I then added some stepper motor code to the standard “MPU6050_DMP” code and downloaded it. This code has the clock set really high and the baud rate set super high as well. When I try and change the baud rate to 38400, the motor is “chatters” like it’s skipping steps or something. Uncommenting the Wire.setClock(400000) didn’t seem to help either. I had to add delays (using the millis() method) to slow it significantly in order to put the stepper code in the same code as the MPU6050. It still “chatters”…
Has anybody run into this when trying to control a motor with the “MPU6050_DMP” code? Is the MPU6050_DMP code just supposed to take up one processor and my instruments/motors should go into another?
MPU6050_DMP6.ino (16.4 KB)
222_Linear_Actuator.ino (20.5 KB)
Capture_Total_Steps.ino (1.69 KB)