Modifications

Sauter à la navigation Sauter à la recherche
475 octets ajoutés ,  24 février 2022 à 00:16
Ligne 146 : Ligne 146 :     
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
from machine import Pin
+
from machine import Pin, PWM
x
+
pwm25 = PWM( Pin(25) )
x
+
pwm.duty_u16( 65534 ) # 100%
x
+
pwm.duty_u16( 32767 ) # 50%
x
+
pwm.duty_u16( 0 ) # 0% = LOW
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
{{underline|Notes:}}
 +
* {{fname|PWM}} class must have a {{fname|Pin}} instance as argument.
 +
* {{fname|duty_u16()}} must have an 16 bits integer value (0 to 65534) for the duty cycle.
 +
* The effective '''Max duty_u16() value is 65534'''. A regression bug would make the 65535 (real max of 16 bits) equivalent to 0 !?!?!... this Phenix bug is coming back again and again.
    
== Hardware buses ==
 
== Hardware buses ==
29 918

modifications

Menu de navigation