Hi, i have an Issue with my Segway code. I am using an ADXL345 accelerometer and a LPY503AL gyroscope. I have a while-true loop that is ran every 20 ms and calculates the angle and outputs the data over serial to the PC. But when I hold the sensors steady, the output stops and i have to reset the Arduino. However, if I tilt the sensor board constantly everything seems to work...
What output did you get on the serial interface before it freezes? Are the last lines sent always the same or is it random where (or when) the freeze occurs?
It seems to be random, sometimes i don't even get a single character, but most times i get about 5 to 15 lines (loops) before it stops (if I don't move the sensors).
Ok, i will do that later (don't have the stiff here right now)
If I hold it skew i get some outputs from the tiltstart routine, eg.
xaccdeg:[somevalue]
xaccdeg:[somevalue]
xaccdeg:[somevalue]
xaccdeg:[somevalue]
xaccdeg:[somevalue]
xa
and then it stops.
If I hold it straight i get some lines from the serialOut_timing function.
But I don't think it has something to do with the values, since it does not only crash on a.specific value.
Edit: I figured out it must be a problem with the accelerometer. I tried to commend the readAccel() function out and it works. However, if i run an example program for this library, everything works just fine.
If I don't hold it skew at the beginning it does, and then it even runs through the main loop for some seconds...
I've just tried antother library - no change.
Seems linke I solved the problem now - Isimply made a new sensor board, so I guess there was some communication problem between the ADXL and the Arduino.
But now I have a new issue: If the arduino is connected to a pc and drains the power over USB, everything works. But if I try an external supply on any connector (V pin, Vin pin, Power jack, cut USB cable with 5V and ground connected) the motors stop until the tiltstart routine is over, but then run at the maximum allowed percentage??