---
title: "Comment by me1234 on \"Generating PWM pulses on the STM32F407 for Servo Motor Control using Bare-Metal Programming\" | Hashnode"
description: "Thanks for the code and the explanation, it works perfectly! Can you tell me what I need to change in order for motor to do just one iteration, I need it to go"
url: "https://hashnode.com/posts/generating-pwm-pulses-on-the-stm32f407-for-servo-motor-control-using-bare-metal-programming/6149657b699fe76cd34857fb/comment/62e1786bd15a9fb24e51457d"
---

[Discussion](https://hashnode.com/posts/generating-pwm-pulses-on-the-stm32f407-for-servo-motor-control-using-bare-metal-programming/6149657b699fe76cd34857fb)

Comment [Generating PWM pulses on the STM32F407 for Servo Motor Control using Bare-Metal Programming](https://hashnode.com/posts/generating-pwm-pulses-on-the-stm32f407-for-servo-motor-control-using-bare-metal-programming/6149657b699fe76cd34857fb)

[me1234](https://hashnode.com/@me1234)

[Jul 27, 2022](https://hashnode.com/posts/generating-pwm-pulses-on-the-stm32f407-for-servo-motor-control-using-bare-metal-programming/6149657b699fe76cd34857fb/comment/62e1786bd15a9fb24e51457d)

Thanks for the code and the explanation, it works perfectly! Can you tell me what I need to change in order for motor to do just one iteration, I need it to go from 0 to 180 degrees and back to 0 degrees just once, not continuously. I tried a bunch of things, nothing worked so far...

[Ruturaj A. Nanoti](https://hashnode.com/@RuturajN)

[Aug 1, 2022](https://hashnode.com/posts/generating-pwm-pulses-on-the-stm32f407-for-servo-motor-control-using-bare-metal-programming/6149657b699fe76cd34857fb/comment/62e1786bd15a9fb24e51457d#reply-62e7953a053e6bd5784295ea)

Hi, I am glad you found this helpful. As for your question, add a `break` statement, after this line: [github.com/Ruturajn/Interfacing-sg90-servo-motor-…](https://github.com/Ruturajn/Interfacing-sg90-servo-motor-with-stm32f407-DISC1/blob/3e0aa99a50e7068b4328bb2417f0585d83dc0296/main.c#L49,) and that should move the motor from 0 to 180, and then back to 0, and stop.
