PWM on any pin

The official pyboard running MicroPython.
This is the reference design and main target board for MicroPython.
You can buy one at the store.
Target audience: Users with a pyboard.
Post Reply
rhubarbdog
Posts: 168
Joined: Tue Nov 07, 2017 11:45 pm

PWM on any pin

Post by rhubarbdog » Fri Sep 07, 2018 2:06 am

hi,
I'm following the example <a href="http://docs.micropython.org/en/latest/p ... ">here.</a> it all works well.
When i try to move it to new pin say X8 i run into problems.
I change timer to one on pin X8 but the channel on some is indicated as 1N, how do i present this identifier to pyb.Timer.channel ? which takes a (positive?) integer as it's first argument.
changing the first couple of lines to read
<code>
tim = pyb.Timer(8, freq = 100)
tchannel = tim.channel(1, pyb.Timer.PWM,
pin=pyb.Pin.board.X8, pulse_width = 0)
</code>
results in a flashing LED at about 1-2Hz, which i know isn't good as it should be channel 1N

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: PWM on any pin

Post by dhylands » Fri Sep 07, 2018 5:03 am

Channel 1N is channel 1, but the output is a negated version of channel 1.

fillofonta
Posts: 7
Joined: Mon Jul 13, 2020 8:55 am

Re: PWM on any pin

Post by fillofonta » Wed Jul 29, 2020 9:59 am

hy, how do i use the negated channel? i need it in order to use a big BLDC motor that doesn't have a driver, i'm using a nucleo-f767zi
PS: how do i make a new post? I can't figure that out...

Post Reply