I am having trouble getting the correct output from my IMU sensor as well as correct output from the Arduino when it is hooked up to a 9V batter rather than the serial port. I am following this Instructable where the only difference between my robot and the instructable's is the motor shield. I am using the Arduino Motorshield V2 instead of the one in the instructable. I can upload my code, but I would have to do it on a different post since my code is more than 9000 characters. The output I am getting from the gyroscope turns to 'nan' after I attempt to test if the motors switch directions correctly. Also, is there anyway to increase the response time of the motors or does it depend on the output of the gyroscope? Also, can someone explain to my why I get a different output when I hook the Arduino up to a 9V battery rather than the serial port? For some reason, when the 9V is hooked up I get a delay from the motors where they stop for a few seconds and then change direction depending on the orientation of the robot when the stall happens.
Also, is there anyway to increase the response time of the motors
delay(1000000000000); will definitely increase the time it takes for the motors to respond.
I suspect that you want to DECREASE the response time.
Also, can someone explain to my why I get a different output when I hook the Arduino up to a 9V battery rather than the serial port?
Because the 9V battery (if you mean those little rectangular ones) are junk. They are worthless for powering anything that requires any amount of current.