1

I have a loop but always inputs the same condition, please see the picture.

enter image description here

  • Likely the output of your IR sensor is always meeting the same condition (either higher than 50 or lower than 50). Try doing this again but instead display the measured value on the screen instead of doing a motor action, and see what values you are reading. – Phil B. Jan 26 '16 at 20:18
  • Yes always print the same values on the screen. So what is the problem? – christian russo Jan 26 '16 at 21:08
  • What values does the sensor show? – dfrevert Jan 27 '16 at 0:14
  • 1
    What are you trying to accomplish with this program? What is the IR sensor measuring? What are you testing it with? As per @DavidLechner's answer, it will spend a lot of time inside the loop after the comparison block executing the actual turn, so any changes you are making should be long enough for the code to return back to the comparison block after completing the turn. – Phil B. Jan 27 '16 at 2:03
2

You have the motor power set to 1 and you are waiting for 1 full rotation. If the motor moves at all, it will take a long time to complete one rotation. Most of the loop is spent waiting for the rotation to complete (or if the motor is not moving at all, then the loop never actually loops).

Try using a higher power - at least 10. Also, use less than one rotation, or use time (just a fraction of a second) instead for the duration of the motor block.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.