For project i need to program that a gyroscope is connected to a bottle. And when the bottle tips over a timer will start counting until the bottle is put rightup again. So i used the same example sketch as assignment 6 for the gyroscope, however when i add the counter in the loop , the arduino stops reading the gyroscope. this way i cannot connect the gyroscope with the timer. How could i solve this
i found the anwser, i only needed to deleted the for () statement
-
Good you found a solution yourself! It is something to keep in mind that the loop() is already repeating by itself. And adding a loop inside that might hold-up the loop() so it cannot process other things. Sometimes it is better to just add a (global) variable to use as a counter. – Fjodor van Slooten Jun 6 at 16:53