Hardware PWM working on the Pi3

After some initial trouble with getting the pi3 to output two hardware PWM channels at the same time, it’s finally working!

Code is here:

import wiringpi
from time import sleep
LED = 1 # gpio pin 12 = wiringpi no. 1 (BCM 18)
LED2 = 23 # gpio pin 33 = wiringpi no. 23 (BCM 13)
# Initialize PWM output for LED
wiringpi.pinMode(LED, 2) # PWM mode
wiringpi.pinMode(LED2, 2)
wiringpi.pwmWrite(LED, 0) # OFF
wiringpi.pwmWrite(LED2, 0)

# Set LED brightness
def led(led_value):


while True:
for value in range(0,1024):

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s