Skip to content

Measuring time #1208

Discussion options

You must be logged in to vote

Finally found a solution, works well!

  //prototyping R
  for (byte i = 0; i < 20; i++) {

    if (  (Data2 > myHT_R[i] && (currentTimeR - startTimeR >= 220) && Data2 < myHT_R[i + 1]) && (currentTimeR - startTimeR >= 220)  ) {
      n = myPWMval[i];
      startTimeR = currentTimeR;
    }

    if (  (Data2 < myHT_R[i]) && (currentTimeR - startTimeR > 420) && (Data2 > myHT_R[i - 1]) && (currentTimeR - startTimeR > 420) ) {
      startTimeR = currentTimeR;
    }
  }
  //actually PWM values according to the defined PWM in the myPMWval[] !
  return n;
}

So far I am using the for loop function to iterate through the arrays and match the values ...
However, wondering if, it would be smarter to …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by coderatchance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant