rpm monitor

hi,
I am using an ac blower for a vectored air supply which levitates and revolves a 600mm liquid mirror (for a telescope)
I have been having trouble with the sketch i have written to control the RPM. of the mirror(dish)

The time is recorded every 90 degrees of rotation, the RPM is calculated and a servo drives the pot of an off the shelf ac motor RPM control, to adjust it.

A laser pointer is reflected off 4 aluminiom strips set at 90 degrees on the dish cicumference ,to a photo resistor.

"delta" keeps being printed as "0"and consequently the RPM is not controlling, despite the calibration showing that the photo resistor is registering.

I am tending to think that perhaps the calibration happens at start up I.E. at low speed and perhaps 1t is too slow to register at twenty RPM.

I would apreciate any suggestions.

I would appreciate any suggestions.

Post your code on the forum. Use the code tags icon </>, at the top left of the toolbar, to create the markers of where to put your code. When done properly, your code should post like this.

Your code here

60 *1000 won't fit in a sixteen bit int.

Thank you all, I will work through the suggestions and repport back.

ie.
1/ put the code in the right place next time
2/ check the grounds
3/ change INT to LONG or other more suited

Terry

The code is fine where it is.
The user base for the online editor is very large.
It will also reflect any changes you make as you go along.
People dont need to be enrolled in the EDITOR to use those links.

You gave a link directly to the CREATE editor view which presents as a very nice alternative (better IMHO) than in a code panel in the forum.
It presents as colour coded and much easier to follow.