I have a Teensy 4.1 that is connected to 2 SG90 servos, a BMP280, and an MPU6050. I also have code that interfaces with all of that and does some things. When I plug this into my computer via USB and I upload the code, everything works great.
The issue arises when I connect it to external power. I have 4 AA batteries inside a battery holder, and I connected it to the 5V and GND pins on my Teensy. The light on the MPU6050 turns on when I do this, indicating that it is receiving power. The issue is, nothing happens while it is on external power. The servos aren't even locked in place, which means these lines of code:
don't even execute, and they are in the middle of the `setup()` function.
I suspect my code doesn't run because:
4 AA batteries (6V) is not nearly enough power for the servos and sensors.
Any advice would be greatly appreciated. Thank you!
The issue arises when I connect it to external power. I have 4 AA batteries inside a battery holder, and I connected it to the 5V and GND pins on my Teensy. The light on the MPU6050 turns on when I do this, indicating that it is receiving power. The issue is, nothing happens while it is on external power. The servos aren't even locked in place, which means these lines of code:
C-like:
/*Init Servos*/
servoX.attach(9); /*x->D9*/
servoY.attach(8); /*y->D8*/
servoX.write(90); /*Initial angle 90deg*/
servoY.write(90); /*Initial angle 90deg*/
don't even execute, and they are in the middle of the `setup()` function.
I suspect my code doesn't run because:
4 AA batteries (6V) is not nearly enough power for the servos and sensors.
Any advice would be greatly appreciated. Thank you!