# Using PWM for motor on H7 Portenta

**URL:** <https://forums.openmv.io/t/using-pwm-for-motor-on-h7-portenta/10159>\
**Category:** Arduino Boards\
**Created:** [November 4, 2024, 4:47am UTC](https://forums.openmv.io/t/using-pwm-for-motor-on-h7-portenta/10159 "2024-11-04T04:47:03Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![prithulc](https://avatars.discourse-cdn.com/v4/letter/p/7bcc69/32.png) [@prithulc](https://forums.openmv.io/u/prithulc)\
**Post date:** [November 4, 2024, 6:15am UTC](https://forums.openmv.io/t/using-pwm-for-motor-on-h7-portenta/10159/3 "2024-11-04T06:15:46Z")

</div>

Thanks for that! I should have known about Timer8.

Could you please help me figure out how PWM works to power a motor on micropython? I have connected D0 to the motor driver and am running the following code that I got from what you suggested someone [here](https://forums.openmv.io/t/pwm/832):

```auto
import time
from pyb import Pin, Timer

tim = Timer(8, freq=1000) # Frequency in Hz
ch1 = tim.channel(1, Timer.PWM, pin=Pin("D0"), pulse_width_percent=75)

while (True):
    time.sleep(1000)

```

Am I missing something fundamental in understand how this works compared to Arduino/Raspberry Pi’s PWM?

PC

---

_[View the full topic](https://forums.openmv.io/t/using-pwm-for-motor-on-h7-portenta/10159)._
