debuging

This program should time wheel rotation to give speed and duration of coasting and calculate deceleration.
can someone tell why it won't progress past rotation 1? I am not sure if I am using long unsigned properly.
At first it checks for speed above the starting speed and buzzes for 1 second and checks for the specified beginning speed as the coast begins. Then it counts 100 wheel revolutions and measures the end speed and calculates deceleration, and starts another test. I have an adjustable oscillator with a optical pnp output and it works the rotation part OK. my first sketch hung up on the first speed test too.

sketch_ap11a.ino (2.68 KB)

I wanted to limit the tests maybe "if" is better than while.

The serial.print are there for debugging.

x[rotate] is only for 0,1 and 2. 96 is subtracted from the larger ones.

The test is the number of times the sketch can run.

After the deceleration is calculated the test starts new. x[3] is used to check if the speed checks have passed.

yes Delta_G you are right I just need to remove the print, it was just there to see if it would get past rotation 2.

You are right again the curly bracket needs to be at the end.

Now the"if, break" doesn't work