|
|
@@ -10,11 +10,14 @@
|
|
|
|
|
|
from machine import PWM # Import PWM class from machine
|
|
|
|
|
|
-pwm = PWM(1, 4, 1000, 100) # Create PWM object. Currently, 4 channels of PWM device numbered 1 are used.
|
|
|
+pwm = PWM(3, 3, 1000, 100) # Create PWM object. Currently, 3 channels of PWM device numbered 3 are used.
|
|
|
# The initialization frequency is 1000Hz and the duty ratio value is 100 (duty ratio is 100/255 = 39.22%).
|
|
|
pwm.freq(2000) # Set the frequency of PWM object
|
|
|
pwm.freq() # Get the frequency of PWM object
|
|
|
-pwm.duty(200) # sets the duty ratio value of PWM object
|
|
|
+print(pwm) # Show PWM object information
|
|
|
+pwm.duty(200) # Sets the duty ratio value of PWM object
|
|
|
pwm.duty() # Get the duty ratio value of PWM object
|
|
|
-pwm.deinit() # close PWM object
|
|
|
-pwm.init(4, 1000, 100) # open and reconfigure the PWM object
|
|
|
+print(pwm) # Show PWM object information
|
|
|
+pwm.deinit() # Close PWM object
|
|
|
+pwm.init(3, 1000, 100) # Open and reconfigure the PWM object
|
|
|
+print(pwm) # Show PWM object information
|