Google Chat: zj734465502@gmail.com
+86-0755-88291180
sales01@spotpear.com
dragon_manager@163.com
services01@spotpear.com
manager01@spotpear.com
WhatsApp:13246739196
The first parameter ID represents the GPIO number, and the value should be 0-29. If GPIO13 is used, fill in 13 here.
The second parameter mode represents the GPIO mode and can be set to no initialization, input mode, output mode and open-drain mode
The third parameter pull is to use the internal pull-up and pull-down resistor, which can be set to pull-up, pull-down and floating. Note that this parameter is only valid in input mode.
The fourth parameter is the output value, and the port value is valid in output or open-drain mode.
Its function is to re-initialize the GPIO, and the parameters are the same as the PIN constructor, so I won't go into details here.
The value function in the PIN class is used to return the value of the GPIO port without filling in the parameter, and write the parameter into the GPIO port when the parameter is filled in, and the parameter can be 0 or 1;
The PIN class irq function is an external interrupt function, the first parameter is the interrupt trigger callback function; the second parameter trigger is the interrupt trigger condition, which is set to edge trigger or level trigger.
This article is only for RP2040 MicroPython firmware, and the source code shall prevail. This article is written according to the official source code at the time of writing, which is used to provide convenience for beginners and is for reference only. Those who are capable are recommended to refer to MicroPython.