Modifications

Sauter à la navigation Sauter à la recherche
141 octets ajoutés ,  27 octobre 2024 à 23:22
Ligne 28 : Ligne 28 :     
<syntaxhighlight lang="python" line>
 
<syntaxhighlight lang="python" line>
−
from machine import Pin
+
from machine import Pin, ADC
 
import time
 
import time
−
p = Pin( 2, Pin.OUT )
     −
# Allumer la LED
+
# Désactive PowerSafe (lower ripple)
−
p.value( True )
+
Pin( 23, Pin.OUT, value=True )
−
time.sleep(1)
     −
# Eteindre la LED
+
a0 = ADC( Pin( Pin.board.GP26 ) )
−
p.value( False )
+
while True:
 +
    val = a0.read_u16()
 +
    volt = val*3.3/65535
 +
    print( 'adc= %5i , volt= %1.2f' % (val,volt) )
 +
    time.sleep_ms( 300 )
 
</syntaxhighlight>
 
</syntaxhighlight>
  
32 908

modifications

Menu de navigation