# Pan tilt servos

**URL:** <https://discourse.nodered.org/t/pan-tilt-servos/80173>\
**Category:** General\
**Tags:** function-node\
**Created:** [30 July 2023 21:38 UTC](https://discourse.nodered.org/t/pan-tilt-servos/80173 "2023-07-30T21:38:57Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ronbu](https://avatars.discourse-cdn.com/v4/letter/r/9e8a1a/32.png) [@ronbu](https://discourse.nodered.org/u/ronbu)\
**Post date:** [30 July 2023 21:38 UTC](https://discourse.nodered.org/t/pan-tilt-servos/80173/1 "2023-07-30T21:38:57Z")

</div>

I want to sweep a 360 degree servo for 4 seconds to the right then delay for 5 seconds then sweep the servo to the left for 4 seconds then delay for 5 seconds then repeat till I send a stop command. I can move the servo but in the function node I don't know how to write the script.  
So I need a delay or seTimeout and a loop to do so. Thank you. Ron.

---

<div class="post-metadata">

**Author:** ![Sean-McG](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sean-mcg/32/54677_2.png) [@Sean-McG](https://discourse.nodered.org/u/Sean-McG)\
**Post date:** [31 July 2023 00:13 UTC](https://discourse.nodered.org/t/pan-tilt-servos/80173/2 "2023-07-31T00:13:58Z")

</div>

You don't give us much to go on here, but I would suggest you look at the trigger node.

---

<div class="post-metadata">

**Author:** ![ronbu](https://avatars.discourse-cdn.com/v4/letter/r/9e8a1a/32.png) [@ronbu](https://discourse.nodered.org/u/ronbu)\
**Post date:** [31 July 2023 22:28 UTC](https://discourse.nodered.org/t/pan-tilt-servos/80173/3 "2023-07-31T22:28:20Z")

</div>

thank you that did what i was trying to do BUT,, I don't know how to stop it. how do i send my flow so you could have a bit more info to help me I don't remember how to do that. Ron. """ or ... i don,t know.

---

<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:** [31 July 2023 22:31 UTC](https://discourse.nodered.org/t/pan-tilt-servos/80173/4 "2023-07-31T22:31:52Z")

</div>

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote `````)

````auto
``` 
   code goes here 
```

````

You can edit and correct your post by clicking the pencil ✏ icon.

See this post for more details - [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:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [29 September 2023 22:31 UTC](https://discourse.nodered.org/t/pan-tilt-servos/80173/5 "2023-09-29T22:31:54Z")

</div>

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