Answers.Body: <p>Your code instructs the motor to continuously turn in one direction, and because you chose a motor block in the “on” mode, it will continue to turn even during the loop condition check. The loop condition says the loop will continue as long as the button is released (AFAIK, I don’t have an EV3 close by currently to validate this), which means that it does exactly the opposite of what you intended. Change the loop condition to loop as long as the touch sensor is pressed and you will fix this issue. Plus, once the loop finishes, the motor will still continue to turn; you would need to put a Motor block in the “off” mode directly after the loop.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-06T03:07:49.103Z
Answers.Text: That's what I thought, but I was wrong. The loop goes until the parameter is true. The loop will go until the touch sensor is released.
Answers.UserDisplayName: legomyleg
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-06T03:10:05.970Z
Answers.Text: Even if that’s true, the lack of a “motor off” block immediately after the loop is why the hand keeps gripping.
Answers.UserDisplayName: Phil B.
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-06T03:11:50.447Z
Answers.Text: Also, the "on" block only turns the motor on for the duration of the next blocks run time. If you had the blocks "motor on", "wait 1 sec", and "play sound" in that order, the motor would stop before the sound played.
Answers.UserDisplayName: legomyleg
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-06T03:12:39.417Z
Answers.Text: http://www.legoengineering.com/rookie-ev3-tip-motor-on-mode/
Answers.UserDisplayName: legomyleg
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-06T03:14:56.570Z
Answers.Text: Nevermind, I was wrong
Answers.UserDisplayName: legomyleg
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-06T03:04:20.943Z
Answers.LastActivityDate: 2018-01-06T03:04:20.943Z
Answers.UserDisplayName: Phil B.
Answers.Body: <p><a href="https://i.sstatic.net/RyhwT.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/RyhwT.png" alt="Code for robotics finger" /></a>
  What your current code does is to keep closing the finger until you press the sensor. This code may help.</p>
  <p>You might need to change the 180 degrees boxes according to how many degrees the motor has to turn to close the finger.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-08T10:48:27.637Z
Answers.LastActivityDate: 2018-01-08T10:48:27.637Z
Answers.LastEditDate: 2020-06-18T08:28:58.637Z
Answers.UserDisplayName: Vikhyat Agarwal
Answers.Body: <p>You need to stop the motor after the loop</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-20T14:31:32.607Z
Answers.LastActivityDate: 2018-01-20T14:31:32.607Z
Answers.UserDisplayName: Ryan Jin
Body: <p>I am building a robotic hand, and I programmed the finger to close when the touch sensor is pressed, and release when the touch sensor is released. It did that with a loop block - <a href="https://i.sstatic.net/6fzbs.png" rel="noreferrer"><img src="https://i.sstatic.net/6fzbs.png" alt="enter image description here"></a> </p>
  
  <p>but when I ran this the finger kept holding down. I could tell because when I tried to gently tug on the motor, it wouldn't budge.</p>
  
  <p>Can anybody tell me what's going on?</p>
  
Tags: <ev3><motor>
Title: Why won't the loop block in my EV3 program stop?
UserDisplayName: legomyleg
ThreadText: # Why won't the loop block in my EV3 program stop?
  
  (Asked by: username_0 on 2018-01-06)
  
  I am building a robotic hand, and I programmed the finger to close when the touch sensor is pressed, and release when the touch sensor is released. It did that with a loop block - [![enter image description here](https://i.sstatic.net/6fzbs.png)](https://i.sstatic.net/6fzbs.png)
  
  but when I ran this the finger kept holding down. I could tell because when I tried to gently tug on the motor, it wouldn't budge.
  
  Can anybody tell me what's going on?
  
  **Tags:** ev3, motor
  
  ---
  
  ## 3 answers
  
  ### Answer by username_1 on 2018-01-06. Score: 3
  
  Your code instructs the motor to continuously turn in one direction, and because you chose a motor block in the “on” mode, it will continue to turn even during the loop condition check. The loop condition says the loop will continue as long as the button is released (AFAIK, I don’t have an EV3 close by currently to validate this), which means that it does exactly the opposite of what you intended. Change the loop condition to loop as long as the touch sensor is pressed and you will fix this issue. Plus, once the loop finishes, the motor will still continue to turn; you would need to put a Motor block in the “off” mode directly after the loop.
  
  > **Comments:**
  > **username_0**: That's what I thought, but I was wrong. The loop goes until the parameter is true. The loop will go until the touch sensor is released.  
  > **username_1**: Even if that’s true, the lack of a “motor off” block immediately after the loop is why the hand keeps gripping.  
  > **username_0**: Also, the "on" block only turns the motor on for the duration of the next blocks run time. If you had the blocks "motor on", "wait 1 sec", and "play sound" in that order, the motor would stop before the sound played.  
  > **username_0**: http://www.legoengineering.com/rookie-ev3-tip-motor-on-mode/  
  > **username_0**: Nevermind, I was wrong  
  
  ---
  
  ### Answer by username_2 on 2018-01-08. Score: 0
  
  [![Code for robotics finger](https://i.sstatic.net/RyhwT.png)](https://i.sstatic.net/RyhwT.png)
  What your current code does is to keep closing the finger until you press the sensor. This code may help.
  
  You might need to change the 180 degrees boxes according to how many degrees the motor has to turn to close the finger.
  
  
  ---
  
  ### Answer by username_3 on 2018-01-20. Score: 0
  
  You need to stop the motor after the loop
  
  
  ---
  
  