Multiple Solenoids triggered by Hall Effect Sensor

But, so what? When you are doing this, you have no idea where the crankshaft is. The last eventcount increment could have been 3 degrees or 180 degrees or 350 degrees in the past.

The magnet is placed at TDC. If the event count is only once, and there is only one magnet, there will always be 360 degrees of revolution between each hall pulse. It will also dictate where TDC is for each pulse as well as give you a way to find in degrees where the pistons are through the rotation.

In addition to recording that the hall effect sensor fired, you need to record WHEN it fired. Then, when you know how long it takes to travel one degree, you'll know when (assuming a (relatively) constant speed of rotation) the crankshaft will be at a given position. When it gets to be that time, change the state of the pin.

I agree completely. After rt has been divided by 360, you multiple it my the desired degree. For example. It takes 1000us to make one revolution, 1000/360= 2.778us to make one degree. Say we want to know when its at 50 degrees
2.778 * 50 = 138.889 us

Again my issue is the actual command to tell my device that when the piston is between say 50 degrees and 60 degrees to change the pin state. I was trying to use an if >= and <= statement but couldn’t manage to set it up the way I describe.

The magnet is placed at TDC. If the event count is only once, and there is only one magnet, there will always be 360 degrees of revolution between each hall pulse.

You can't be sure that loop will complete everything it needs to be in one revolution.

You can't be sure that loop won't execute more than once per revolution of the crank.

You can't be sure WHEN the code in loop will execute relative to when the interrupt occurred last.

You can't be sure that loop will complete everything it needs to be in one revolution.

You can't be sure that loop won't execute more than once per revolution of the crank.

You can't be sure WHEN the code in loop will execute relative to when the interrupt occurred last.

I appreciate the advice. I have come the conclusion that it will be a trial basis. If it isn't able to complete the loop etc. then I will continue with a different method, possibly multiple sensors.

I guess what I'm looking for at this moment is how to write my little script. Ignoring all the other possible issues, how do I write what I've been asking about telling the arduino to fire solenoids between rt and rt*179?

Thanks, I appreciate the help so far.