Hello, I am currently writing code for a robot I am building with the arduino zero and a LIS3DH accelerometer. I wrote some demo code to get my robot moving, and now am in the process of converting that code to a library. I built the library but am having a few problems. Everything works perfectly (compiled without errors) until the code reaches the point where it needs to communicate with the acellerometer. The arduino just freezes and does nothing until reset. Like I said earlier, my original demo code worked perfectly so it is not a hardware issue, it is something to do with how I am including the Adafruit sensor library inside of my custom library inside of my sketch. Any ideas? I have a fair bit of experience python and Arduino coding but not much c++ so please point me in the right direction to anything that could solve this perplexing problem. Attached are the files for the library and my sketch. Thanks, Tyler
You don't understand what loop() actually does, I see.
I can't imagine why you attach and detach the servos all over the place.
The convoluted code at the end of the while statement is silly. The while loop will end on it's own accord when TIMEOUT gets to be 2. By convention, all capital letter names are reserved for constants. The value of a constant is NOT incremented.
In checkForFall(), is it pointless to calibrate() when you just intend to go catatonic.
verything works perfectly (compiled without errors) until the code reaches the point where it needs to communicate with the acellerometer.
How do you know this? You have no Serial.print() statements to back up this claim.
Wow! Thanks for the help, my code magically started working