Modifications

Sauter à la navigation Sauter à la recherche
556 octets ajoutés ,  21 février 2022 à 00:52
Ligne 33 : Ligne 33 :     
To avoids that issue, the best is to use a pull-up resistor. Many microcontroler have internal pull-up resistor (it just needs to be activated).
 
To avoids that issue, the best is to use a pull-up resistor. Many microcontroler have internal pull-up resistor (it just needs to be activated).
 +
 +
== Input Reading with Pull-Up ==
 +
The pico can activates a Pull-up resistor on any of its input pins.
 +
 +
When the Pin is tied to ground then the input is Low (0) otherwise, the pull-up resistor will drive back the pin voltage to 3.3V.
 +
 +
The following code will read the state of the GP15 configured as input pin + pull-up.
 +
 +
<syntaxhighlight lang="python">
 +
>>> from machine import Pin
 +
>>> p = Pin( 15, Pin.IN, PIN.PULLUP )
 +
>>> p.value()
 +
0                <--- Pin tied to GND
 +
>>> p.value()
 +
1                <--- Pin tied to 3.3V or floating.
 +
</syntaxhighlight>
    
== Analog Reading ==
 
== Analog Reading ==
29 917

modifications

Menu de navigation