MicroPython v1.19 on 2022-06-23; linux [GCC 9.4.0] on Raspberry pi 4b Code #2 #11225
Unanswered
FlydGitHub
asked this question in
Other
Replies: 2 comments 1 reply
-
The Unix port of MicroPython doesn't support pin I/O. If you want to run this kind of code you could use a Pico or Pico W. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Thanks Peter, My plan was to use the RP 4B OS as a development environment for the Pico. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
import time
from machine import Pin, PWM
Define the maximum achievable PWM frequency in Hz
pwm_freq = 100000
Define the duty cycle (0-1023)
duty_cycle = 512
Define the GPIO pin for the PWM output in BOARD mode
pwm_pin = 40
Configure the PWM output with the specified frequency and duty cycle
pwm = PWM(Pin(pwm_pin))
pwm.freq(pwm_freq)
pwm.duty(duty_cycle)
Wait indefinitely
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
pass
Beta Was this translation helpful? Give feedback.
All reactions