# Servo going in a loop

**URL:** <https://discourse.nodered.org/t/servo-going-in-a-loop/61063>\
**Category:** Dashboard\
**Tags:** node-red-dashboard\
**Created:** [10 April 2022 13:03 UTC](https://discourse.nodered.org/t/servo-going-in-a-loop/61063 "2022-04-10T13:03:56Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![node2](https://avatars.discourse-cdn.com/v4/letter/n/ea666f/32.png) [@node2](https://discourse.nodered.org/u/node2)\
**Post date:** [10 April 2022 13:03 UTC](https://discourse.nodered.org/t/servo-going-in-a-loop/61063/1 "2022-04-10T13:03:56Z")

</div>

i m using a servo as gate that opens and close when i click a button linking them both to Trigger, the problem is :  
the servo keeps moving +90 to -90 degrees back and forth in infinite loop 🙂

---

<div class="post-metadata">

**Author:** ![edje11](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/edje11/32/572_2.png) [@edje11](https://discourse.nodered.org/u/edje11)\
**Post date:** [10 April 2022 13:07 UTC](https://discourse.nodered.org/t/servo-going-in-a-loop/61063/2 "2022-04-10T13:07:04Z")

</div>

That's not good.

---

<div class="post-metadata">

**Author:** ![node2](https://avatars.discourse-cdn.com/v4/letter/n/ea666f/32.png) [@node2](https://discourse.nodered.org/u/node2)\
**Post date:** [10 April 2022 13:09 UTC](https://discourse.nodered.org/t/servo-going-in-a-loop/61063/3 "2022-04-10T13:09:26Z")

</div>

Thanks for the feedback, do you have any advise to stop the loop?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [10 April 2022 13:10 UTC](https://discourse.nodered.org/t/servo-going-in-a-loop/61063/4 "2022-04-10T13:10:20Z")

</div>

Have you tried editing your flow?

---

<div class="post-metadata">

**Author:** ![node2](https://avatars.discourse-cdn.com/v4/letter/n/ea666f/32.png) [@node2](https://discourse.nodered.org/u/node2)\
**Post date:** [10 April 2022 13:11 UTC](https://discourse.nodered.org/t/servo-going-in-a-loop/61063/5 "2022-04-10T13:11:18Z")

</div>

like how precisely

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [10 April 2022 13:11 UTC](https://discourse.nodered.org/t/servo-going-in-a-loop/61063/6 "2022-04-10T13:11:54Z")

</div>

How would we know? you have supplied no information.

---

<div class="post-metadata">

**Author:** ![node2](https://avatars.discourse-cdn.com/v4/letter/n/ea666f/32.png) [@node2](https://discourse.nodered.org/u/node2)\
**Post date:** [10 April 2022 13:16 UTC](https://discourse.nodered.org/t/servo-going-in-a-loop/61063/7 "2022-04-10T13:16:52Z")

</div>

Sorry if I wasn't clear enough. the flow consist of three components a button a trigger and a PWM servo, the goal is when button clicked the servo will move 90 degrees then come back to the initial value then Stops once for all , the problem in my case is that the servo keeps moving by going back and forth

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [10 April 2022 13:23 UTC](https://discourse.nodered.org/t/servo-going-in-a-loop/61063/8 "2022-04-10T13:23:13Z")

</div>

It's like me asking, i have a piece of string, if i hold it up and it touches the floor, how long is it?

supply a flow and the input messages

read this to find out how to capture messages  
[https://nodered.org/docs/user-guide/messages](https://nodered.org/docs/user-guide/messages)  
and this to export your flow  
[https://nodered.org/docs/user-guide/editor/workspace/import-export](https://nodered.org/docs/user-guide/editor/workspace/import-export)

and how to post the info [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

---

<div class="post-metadata">

**Author:** ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)\
**Post date:** [10 April 2022 16:17 UTC](https://discourse.nodered.org/t/servo-going-in-a-loop/61063/9 "2022-04-10T16:17:39Z")

</div>

Maybe attach a `debug` node to the output of the `trigger` node so you can see what is being passed onward

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [10 April 2022 16:32 UTC](https://discourse.nodered.org/t/servo-going-in-a-loop/61063/10 "2022-04-10T16:32:09Z")

</div>

Do you have a feedback mechanism - the button triggers the servo, servo responds and updates the button?

I sometimes get a smart socket "hunting" (is that the word?) because I update the button with the smart socket's reported status. If I happen to press the button again before the response arrives it starts a chain reaction.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 May 2022 16:32 UTC](https://discourse.nodered.org/t/servo-going-in-a-loop/61063/11 "2022-05-10T16:32:48Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
