4 ms·
Do it in the logical way until you hit the output pins. Ding, ding, ding!!! We have a winner. This is exactly correct: write your code the way everything shoul
by HeyLaughingBoy 17y ago
Do it in the logical way until you hit the output pins.
Ding, ding, ding!!! We have a winner. This is exactly correct: write your code the way everything should be in a perfect world, BUT have a hardware abstraction layer to separate that from reality. The upper layer code should just know that when the end sensor is reached, the hydraulic ram should be reversed. The HAL knows what state the end sensor must be in when it's triggered, and what polarity to send to the valve controlling the hydraulic ram.
Even in small embedded systems, a properly tiered architecture can save a lot of trouble.