Extract below read's pressure value A. If it's 200000, B is actioned. However, pressure follows a sign wave fluctuating between 100000 and 200000, need to skip A=200000 every THREE times and then action B.
IS there a simple one line statement which can read A=200000, action B, then skip the next A=200000 THREE times and then action B. The loop continue in while statement.
[code]
"
"
Int main ();
{
While (1<q<500)
{
if A=200000 THEN //*
B=300;
else if A=100000 THEN
B=310;
}
end_f_loop(f,th)
}
> Extract below read's pressure value A. If it's 200000, B is actioned.
> However, pressure follows a sign wave fluctuating between 100000 and 200000
Are you working with some idealised sine wave that's guaranteed to hit 100000 and 200000 every cycle?
Your code is nowhere near being valid C++, so it's of little use in understanding your question.
> then skip the next A=200000 THREE times and then action B. https://en.wikipedia.org/wiki/Finite-state_machine
You have two states, one for performing the action, and another for counting the interval.
Or even a simple counter
1 2 3 4
if ( A ) {
if ( count == 0 ) do B
else count = ( count + 1 ) % 4
}