Modifications

Sauter à la navigation Sauter à la recherche
226 octets ajoutés ,  21 février 2022 à 02:39
Ligne 82 : Ligne 82 :  
p = Pin( 27 )
 
p = Pin( 27 )
 
analog = ADC( p )
 
analog = ADC( p )
 +
#
 +
# Read the ADC value
 
value = analog.read_u16()
 
value = analog.read_u16()
 
print( 'value: %i' % value )
 
print( 'value: %i' % value )
x
+
#
x
+
# Transform into volts
x
+
volts = 3.3*value/65535
 +
print( 'Volts: %f' % volts )
 +
</syntaxhighlight>
 +
 
 +
This may produce the following output in the REPL.
 +
 
 +
<syntaxhighlight lang="bash">
 +
value: 8706
 +
Volts: 0.438389
 
</syntaxhighlight>
 
</syntaxhighlight>
  
29 918

modifications

Menu de navigation