Pin - Control I/O Pins

This class provides methods of reading and writing GPIO. A pin object is used to control I/O pins (also known as GPIO - general-purpose input/output). The pin class has methods to set the mode of the pin (IN, OUT, etc) and methods to get and set the digital logic level.

Example:

from machine import Pin

# Creates a GPIO object
gpio1 = Pin(Pin.GPIO1, Pin.OUT, Pin.PULL_DISABLE, 1)

# Gets the pin level
gpio1.read()

# Sets the pin level
gpio1.write(0)
gpio1.write(1)

# Sets input and output modes
gpio1.set_dir(Pin.IN)
gpio1.set_dir(Pin.OUT)

# Gets input and output modes
gpio1.get_dir()

Constructor

machine.Pin

class machine.Pin(GPIOn, direction, pullMode, level)

Parameter:

  • GPIOn - Integer type. GPIO number. Click here to view the mapping relationship between GPIO pin numbers and physical pins.
  • direction - Integer type. I/O mode. IN - Input mode. OUT - Output mode.
  • pullMode - Integer type. Pull selection mode. Descriptions are as follows:
    PULL_DISABLE - Floating mode
    PULL_PU - Pull-up mode
    PULL_PD - Pull-down mode
  • level - Integer type. Pin level. 0 - Set pin to low level. 1- Set pin to high level.

Example:

>>> # Creates a GPIO object
>>> from machine import Pin
>>> gpio1 = Pin(Pin.GPIO1, Pin.OUT, Pin.PULL_DISABLE, 0)

Mapping Relationship Between GPIO Pin Numbers and Physical Pins:

Description of GPIO corresponding pin numbers: GPIO pin numbers provided in the document correspond to external pin numbers of the module. For example, for EC100Y-CN module, GPIO1 corresponds to pin22, which is an external pin number of the module. See the provided hardware documents for external pin numbers of the module.

Pin Correspondences of EC100Y Series Module
GPIO1 – Pin22
GPIO2 – Pin23
GPIO3 – Pin38
GPIO4 – Pin53
GPIO5 – Pin54
GPIO6 – Pin104
GPIO7 – Pin105
GPIO8 – Pin106
GPIO9 – Pin107
GPIO10 – Pin178
GPIO11 – Pin195
GPIO12 – Pin196
GPIO13 – Pin197
GPIO14 – Pin198
GPIO15 – Pin199
GPIO16 – Pin203
GPIO17 – Pin204
GPIO18 – Pin214
GPIO19 – Pin215
Pin Correspondences of EC600S/EC600N Series Module GPIO1 – Pin10
GPIO2 – Pin11
GPIO3 – Pin12
GPIO4 – Pin13
GPIO5 – Pin14
GPIO6 – Pin15
GPIO7 – Pin16
GPIO8 – Pin39
GPIO9 – Pin40
GPIO10 – Pin48
GPIO11 – Pin58
GPIO12 – Pin59
GPIO13 – Pin60
GPIO14 – Pin61
GPIO15 – Pin62
GPIO16 – Pin63
GPIO17 – Pin69
GPIO18 – Pin70
GPIO19 – Pin1
GPIO20 – Pin3
GPIO21 – Pin49
GPIO22 – Pin50
GPIO23 – Pin51
GPIO24 – Pin52
GPIO25 – Pin53
GPIO26 – Pin54
GPIO27 – Pin55
GPIO28 – Pin56
GPIO29 – Pin57
GPIO30 – Pin2
GPIO31 – Pin66
GPIO32 – Pin65
GPIO33 – Pin67
GPIO34 – Pin64
GPIO35 – Pin4
GPIO36 – Pin31
GPIO37 – Pin32
GPIO38 – Pin33
GPIO39 – Pin34
GPIO40 – Pin71
GPIO41 – Pin72
Pin Correspondences of EC600M Series Module GPIO1 – Pin10
GPIO2 – Pin11
GPIO3 – Pin12
GPIO4 – Pin13
GPIO5 – Pin14
GPIO6 – Pin15
GPIO7 – Pin16
GPIO8 – Pin39
GPIO9 – Pin40
GPIO10 – Pin48
GPIO11 – Pin58
GPIO12 – Pin59
GPIO13 – Pin60
GPIO14 – Pin61
GPIO15 – Pin62
GPIO16 – Pin63
GPIO17 – Pin69
GPIO18 – Pin70
GPIO19 – Pin1
GPIO20 – Pin3
GPIO21 – Pin49
GPIO22 – Pin50
GPIO23 – Pin51
GPIO24 – Pin52
GPIO25 – Pin53
GPIO26 – Pin54
GPIO27 – Pin55
GPIO28 – Pin56
GPIO29 – Pin57
GPIO30 – Pin2
GPIO31 – Pin66
GPIO32 – Pin65
GPIO33 – Pin67
GPIO34 – Pin64
GPIO35 – Pin4
GPIO36 – Pin31
GPIO37 – Pin32
GPIO38 – Pin33
GPIO39 – Pin34
GPIO40 – Pin71
GPIO41 – Pin72
GPIO42 – Pin109
GPIO43 – Pin110
GPIO44 – Pin112
GPIO45 – Pin111
Pin Correspondences of EC600U Series Module GPIO1 – Pin61 (It cannot be used together with GPIO31.)
GPIO2 – Pin58 (It cannot be used together with GPIO32.)
GPIO3 – Pin34 (It cannot be used together with GPIO41.)
GPIO4 – Pin60 (It cannot be used together with GPIO34.)
GPIO5 – Pin69 (It cannot be used together with GPIO35.)
GPIO6 – Pin70 (It cannot be used together with GPIO36.)
GPIO7 – Pin123 (It cannot be used together with GPIO43.)
GPIO8 – Pin118
GPIO9 – Pin9 (It cannot be used together with GPIO47.)
GPIO10 – Pin1 (It cannot be used together with GPIO37.)
GPIO11 – Pin4 (It cannot be used together with GPIO38.)
GPIO12 – Pin3 (It cannot be used together with GPIO39.)
GPIO13 – Pin2 (It cannot be used together with GPIO40.)
GPIO14 – Pin54
GPIO15 – Pin57
GPIO16 – Pin56
GPIO17 – Pin12
GPIO18 – Pin33 (It cannot be used together with GPIO42.)
GPIO19 – Pin124 (It cannot be used together with GPIO44.)
GPIO20 – Pin122 (It cannot be used together with GPIO45.)
GPIO21 – Pin121 (It cannot be used together with GPIO46.)
GPIO22 – Pin48
GPIO23 – Pin39
GPIO24 – Pin40
GPIO25 – Pin49
GPIO26 – Pin50
GPIO27 – Pin53
GPIO28 – Pin52
GPIO29 – Pin51
GPIO30 – Pin59 (It cannot be used together with GPIO33.)
GPIO31 – Pin66 (It cannot be used together with GPIO1.)
GPIO32 – Pin63 (It cannot be used together with GPIO2.)
GPIO33 – Pin67 (It cannot be used together with GPIO30.)
GPIO34 – Pin65 (It cannot be used together with GPIO4.)
GPIO35 – Pin137 (It cannot be used together with GPIO5.)
GPIO36 – Pin62 (It cannot be used together with GPIO6.)
GPIO37 – Pin98 (It cannot be used together with GPIO10.)
GPIO38 – Pin95 (It cannot be used together with GPIO11.)
GPIO39 – Pin119 (It cannot be used together with GPIO12.)
GPIO40 – Pin100 (It cannot be used together with GPIO13.)
GPIO41 – Pin120 (It cannot be used together with GPIO3.)
GPIO42 – Pin16 (It cannot be used together with GPIO18.)
GPIO43 – Pin10 (It cannot be used together with GPIO7.)
GPIO44 – Pin14 (It cannot be used together with GPIO19.)
GPIO45 – Pin15 (It cannot be used together with GPIO20.)
GPIO46 – Pin13 (It cannot be used together with GPIO21.)
GPIO47 – Pin99 (It cannot be used together with GPIO9.)
Pin Correspondences of EC200U Series Module GPIO1 – Pin27 (It cannot be used together with GPIO31.)
GPIO2 – Pin26 (It cannot be used together with GPIO32.)
GPIO3 – Pin24 (It cannot be used together with GPIO33.)
GPIO4 – Pin25 (It cannot be used together with GPIO34.)
GPIO5 – Pin13 (It cannot be used together with GPIO17.)
GPIO6 – Pin135 (It cannot be used together with GPIO36.)
GPIO7 – Pin136 (It cannot be used together with GPIO44.)
GPIO8 – Pin133
GPIO9 – Pin3 (It cannot be used together with GPIO37.)
GPIO10 – Pin40 (It cannot be used together with GPIO38.)
GPIO11 – Pin37 (It cannot be used together with GPIO39.)
GPIO12 – Pin38 (It cannot be used together with GPIO40.)
GPIO13 – Pin39 (It cannot be used together with GPIO41.)
GPIO14 – Pin5
GPIO15 – Pin141
GPIO16 – Pin142
GPIO17 – Pin121 (It cannot be used together with GPIO5.)
GPIO18 – Pin65 (It cannot be used together with GPIO42.)
GPIO19 – Pin64 (It cannot be used together with GPIO43.)
GPIO20 – Pin139 (It cannot be used together with GPIO45.)
GPIO21 – Pin126 (It cannot be used together with GPIO46.)
GPIO22 – Pin127 (It cannot be used together with GPIO47.)
GPIO23 – Pin33
GPIO24– Pin31
GPIO25 – Pin30
GPIO26 – Pin29
GPIO27 – Pin28
GPIO28 – Pin1
GPIO29 – Pin2
GPIO30 – Pin4
GPIO31 – Pin125 (It cannot be used together with GPIO1.)
GPIO32 – Pin124 (It cannot be used together with GPIO2.)
GPIO33 – Pin123 (It cannot be used together with GPIO3.)
GPIO34 – Pin122 (It cannot be used together with GPIO4.)
GPIO35 – Pin42
GPIO36 – Pin119 (It cannot be used together with GPIO6.)
GPIO37 – Pin134 (It cannot be used together with GPIO9.)
GPIO38– Pin132 (It cannot be used together with GPIO10.)
GPIO39 – Pin131 (It cannot be used together with GPIO11.)
GPIO40 – Pin130 (It cannot be used together with GPIO12.)
GPIO41 – Pin129 (It cannot be used together with GPIO13.)
GPIO42 – Pin61 (It cannot be used together with GPIO18.)
GPIO43 – Pin62 (It cannot be used together with GPIO19.)
GPIO44 – Pin63 (It cannot be used together with GPIO7.)
GPIO45 – Pin66 (It cannot be used together with GPIO20.)
GPIO46 – Pin6 (It cannot be used together with GPIO21.)
GPIO47 – Pin23 (It cannot be used together with GPIO22.)
Pin Correspondences of EC200A/UC200A Series Module GPIO1 – Pin27
GPIO2 – Pin26
GPIO3 – Pin24
GPIO4 – Pin25
GPIO5 – Pin5
GPIO6 – Pin135
GPIO7 – Pin136
GPIO8 – Pin68
GPIO9 – Pin3
GPIO10 – Pin40
GPIO11 – Pin37
GPIO12 – Pin38
GPIO13 – Pin39
GPIO14 – Pin67
GPIO15 – Pin13
GPIO18 – Pin65
GPIO19 – Pin64
GPIO20 – Pin139
GPIO22 – Pin127
GPIO27 – Pin28
GPIO28 – Pin1
GPIO29 – Pin2
GPIO30 – Pin4
GPIO35 – Pin42
GPIO36 – Pin119
GPIO43 – Pin62
GPIO44 – Pin63
GPIO45 – Pin66
GPIO46 – Pin6
GPIO47 – Pin23
Pin Correspondences of EC800N Module GPIO1 – Pin30
GPIO2 – Pin31
GPIO3 – Pin32
GPIO4 – Pin33
GPIO5 – Pin49
GPIO6 – Pin50
GPIO7 – Pin51
GPIO8 – Pin52
GPIO9 – Pin53
GPIO10 – Pin54
GPIO11 – Pin55
GPIO12 – Pin56
GPIO13 – Pin57
GPIO14 – Pin58
GPIO15 – Pin80
GPIO16 – Pin81
GPIO17 – Pin76
GPIO18 – Pin77
GPIO19 – Pin82
GPIO20 – Pin83
GPIO21 – Pin86
GPIO22 – Pin87
GPIO23 – Pin66
GPIO24 – Pin67
GPIO25 – Pin17
GPIO26 – Pin18
GPIO27 – Pin19
GPIO28 – Pin20
GPIO29 – Pin21
GPIO30 – Pin22
GPIO31 – Pin23
GPIO32 – Pin28
GPIO33 – Pin29
GPIO34 – Pin38
GPIO35 – Pin39
GPIO36 – Pin16
GPIO37 – Pin78
Pin Correspondences of BC25 Series Module GPIO1 – Pin3
GPIO2 – Pin4
GPIO3 – Pin5
GPIO4 – Pin6
GPIO5 – Pin16
GPIO6 – Pin20
GPIO7 – Pin21
GPIO8 – Pin22
GPIO9 – Pin23
GPIO10 – Pin25
GPIO11 – Pin28
GPIO12 – Pin29
GPIO13 – Pin30
GPIO14 – Pin31
GPIO15 – Pin32
GPIO16 – Pin33
GPIO17 – Pin2
GPIO18 – Pin8
Pin Correspondences of BG95 Module GPIO1 – Pin4
GPIO2 – Pin5
GPIO3 – Pin6
GPIO4 – Pin7
GPIO5 – Pin18
GPIO6 – Pin19
GPIO7 – Pin22
GPIO8 – Pin23
GPIO9 – Pin25
GPIO10 – Pin26
GPIO11 – Pin27
GPIO12 – Pin28
GPIO13 – Pin40
GPIO14 – Pin41
GPIO15 – Pin64
GPIO16 – Pin65
GPIO17 – Pin66
GPIO18 – Pin85
GPIO19 – Pin86
GPIO20 – Pin87
GPIO21 – Pin88
GPIO22 – Pin20
GPIO23 – Pin21
GPIO24 – Pin30
GPIO25 – Pin34
GPIO26 – Pin35
GPIO27 – Pin36
GPIO28 – Pin37
GPIO29 – Pin38
GPIO30 – Pin39
Pin Correspondences of EG915U Series Module GPIO1 – Pin4 (It cannot be used together with GPIO41.)
GPIO2 – Pin5 (It cannot be used together with GPIO36.)
GPIO3 – Pin6 (It cannot be used together with GPIO35.)
GPIO4 – Pin7 (It cannot be used together with GPIO24.)
GPIO5 – Pin18
GPIO6 – Pin19
GPIO7 – Pin1 (It cannot be used together with GPIO37.)
GPIO8 – Pin38
GPIO9 – Pin25
GPIO10 – Pin26
GPIO11 – Pin27 (It cannot be used together with GPIO32.)
GPIO12 – Pin28 (It cannot be used together with GPIO31.)
GPIO13 – Pin40
GPIO14 – Pin41
GPIO15 – Pin64
GPIO16 – Pin20 (It cannot be used together with GPIO30.)
GPIO17 – Pin21
GPIO18 – Pin85 (It cannot be reused when using the dual-SIM standby function.)
GPIO19 – Pin86 (It cannot be reused when using the dual-SIM standby function.)
GPIO20 – Pin30
GPIO21 – Pin88
GPIO22 – Pin36 (It cannot be used together with GPIO40.)
GPIO23 – Pin37 (It cannot be used together with GPIO38.)
GPIO24 – Pin16 (It cannot be used together with GPIO4.)
GPIO25 – Pin39
GPIO26 – Pin42 (It cannot be used together with GPIO27.)
GPIO27 – Pin78 (It cannot be used together with GPIO26.)
GPIO28 – Pin83 (It cannot be used together with GPIO33.)
GPIO29 – Pin84 (It cannot be reused when using the dual-SIM standby function.)
GPIO30 – Pin92 (It cannot be used together with GPIO16.)
GPIO31 – Pin95 (It cannot be used together with GPIO12.)
GPIO32 – Pin97 (It cannot be used together with GPIO11.)
GPIO33 – Pin98 (It cannot be used together with GPIO28.)
GPIO34 – Pin104
GPIO35 – Pin105 (It cannot be used together with GPIO3.)
GPIO36 – Pin106 (It cannot be used together with GPIO2.)
GPIO37 – Pin108 (It cannot be used together with GPIO4.)
GPIO38 – Pin111 (It cannot be used together with GPIO23.)
GPIO39 – Pin114
GPIO40 – Pin115 (It cannot be used together with GPIO22.)
GPIO41 – Pin116 (It cannot be used together with GPIO1.)
Pin Correspondences of EC800M/EG810M Module GPIO1 – Pin30
GPIO2 – Pin31
GPIO3 – Pin32
GPIO4 – Pin33
GPIO5 – Pin49
GPIO6 – Pin50
GPIO7 – Pin51
GPIO8 – Pin52
GPIO9 – Pin53
GPIO10 – Pin54
GPIO11 – Pin55
GPIO12 – Pin56
GPIO13 – Pin57
GPIO14 – Pin58
GPIO15 – Pin80
GPIO16 – Pin81
GPIO17 – Pin76
GPIO18 – Pin77
GPIO19 – Pin82
GPIO20 – Pin83
GPIO21 – Pin86(EG810M_EU unsupported)
GPIO22 – Pin87(EG810M_EU unsupported)
GPIO23 – Pin66
GPIO24 – Pin67
GPIO25 – Pin17
GPIO26 – Pin18
GPIO27 – Pin19
GPIO28 – Pin20
GPIO29 – Pin21
GPIO30 – Pin22
GPIO31 – Pin23
GPIO32 – Pin28
GPIO33 – Pin29
GPIO34 – Pin38
GPIO35 – Pin39
GPIO36 – Pin16
GPIO37 – Pin78
GPIO38 – Pin68
GPIO39 – Pin69
GPIO40 – Pin74
GPIO41 – Pin75
GPIO42 – Pin84(EG810M_EU unsupported)
GPIO43 – Pin85(EG810M_EU unsupported)
GPIO44 – Pin25
GPIO45 – Pin105
GPIO46 – Pin104
GPIO47 – Pin79
Pin Correspondences of EG912N Module GPIO1 – Pin4
GPIO2 – Pin5
GPIO3 – Pin6
GPIO4 – Pin7
GPIO5 – Pin18
GPIO6 – Pin19
GPIO7 – Pin1
GPIO8 – Pin16
GPIO9 – Pin25
GPIO10 – Pin26
GPIO11 – Pin27
GPIO12 – Pin28
GPIO13 – Pin40
GPIO14 – Pin41
GPIO15 – Pin64
GPIO16 – Pin20
GPIO17 – Pin21
GPIO18 – Pin30
GPIO19 – Pin34
GPIO20 – Pin35
GPIO21 – Pin36
GPIO22 – Pin37
GPIO23 – Pin38
GPIO24 – Pin39
GPIO25 – Pin42
GPIO26 – Pin78
GPIO27 – Pin83
GPIO28 – Pin92
GPIO29 – Pin95
GPIO30 – Pin96
GPIO31 – Pin97
GPIO32 – Pin98
GPIO33 – Pin103
GPIO34 – Pin104
GPIO35 – Pin105
GPIO36 – Pin106
GPIO37 – Pin107
GPIO38 – Pin114
GPIO39 – Pin115
GPIO40 – Pin116
Pin Correspondences of EG912U Module GPIO1 – Pin4(It cannot be used together with GPIO40)
GPIO2 – Pin5(It cannot be used together with GPIO36)
GPIO3 – Pin6(It cannot be used together with GPIO35)
GPIO4 – Pin7(It cannot be used together with GPIO8)
GPIO5 – Pin18
GPIO6 – Pin19
GPIO7 – Pin1(It cannot be used together with GPIO19)
GPIO8 – Pin16(It cannot be used together with GPIO4)
GPIO10 – Pin26(EG912UGuLAA unsupported)
GPIO11 – Pin27(It cannot be used together with GPIO31)
GPIO12 – Pin28(It cannot be used together with GPIO29)
GPIO13 – Pin40
GPIO14 – Pin41
GPIO15 – Pin64(EG912UGLAA unsupported)
GPIO16 – Pin20(It cannot be used together with GPIO28)
GPIO17 – Pin21
GPIO18 – Pin30
GPIO19 – Pin108(It cannot be used together with GPIO7)
GPIO20 – Pin88(EG912UGLAA unsupported)
GPIO21 – Pin36(It cannot be used together with GPIO39)
GPIO22 – Pin37(It cannot be used together with GPIO30)
GPIO23 – Pin38
GPIO24 – Pin39
GPIO25 – Pin42(It cannot be used together with GPIO26)
GPIO26 – Pin78(It cannot be used together with GPIO25)
GPIO27 – Pin83(It cannot be used together with GPIO32)
GPIO28 – Pin92(It cannot be used together with GPIO16)
GPIO29 – Pin95(It cannot be used together with GPIO12)
GPIO30 – Pin111(It cannot be used together with GPIO22)
GPIO31 – Pin97(It cannot be used together with GPIO11)
GPIO32 – Pin98(It cannot be used together with GPIO27)
GPIO34 – Pin104
GPIO35 – Pin105(It cannot be used together with GPIO3)
GPIO36 – Pin106(It cannot be used together with GPIO2)
GPIO38 – Pin114
GPIO39 – Pin115(It cannot be used together with GPIO21)
GPIO40 – Pin116(It cannot be used together with GPIO1)
Pin Correspondences of FCM362K Module Pin6
Pin7
Pin8
Pin9
Pin14
Pin15
Pin16
Pin27
Pin28
Pin29
Pin30
Pin31
Pin34
Pin35
Pin37
Pin Correspondences of FCM360W Module Pin6
Pin7
Pin8
Pin9
Pin10
Pin12
Pin13
Pin14
Pin15
Pin16
Pin19
Pin20
Pin21
Pin22
Pin23
Pin29
Pin Correspondences of BC32 Module GPIO1 – Pin12
GPIO2 – Pin13
GPIO3 – Pin41
GPIO4 – Pin42
GPIO5 – Pin21
GPIO6 – Pin22
GPIO7 – Pin23
GPIO8 – Pin24
GPIO9 – Pin26
GPIO10 – Pin43
GPIO11 – Pin44
Pin Correspondences of BC92 Module GPIO1 – Pin12
GPIO2 – Pin13
GPIO3 – Pin41
GPIO4 – Pin42
GPIO5 – Pin21
GPIO6 – Pin22
GPIO7 – Pin23
GPIO8 – Pin24
GPIO9 – Pin26
GPIO10 – Pin43
GPIO11 – Pin44
Pin Correspondences of EG915N Module GPIO1 – Pin4
GPIO2 – Pin5
GPIO3 – Pin6
GPIO4 – Pin7
GPIO5 – Pin18
GPIO6 – Pin19
GPIO7 – Pin1
GPIO8 – Pin38
GPIO9 – Pin25
GPIO10 – Pin26
GPIO11 – Pin27
GPIO12 – Pin28
GPIO13 – Pin40
GPIO14 – Pin41
GPIO15 – Pin64
GPIO16 – Pin20
GPIO17 – Pin21
GPIO18 – Pin34
GPIO19 – Pin35
GPIO20 – Pin30
GPIO21 – Pin22
GPIO22 – Pin36
GPIO23 – Pin37
GPIO24 – Pin16
GPIO25 – Pin39
GPIO26 – Pin23
GPIO27 – Pin78
GPIO28 – Pin83
GPIO29 – Pin107
GPIO30 – Pin92
GPIO31 – Pin95
GPIO32 – Pin97
GPIO33 – Pin98
GPIO34 – Pin104
GPIO35 – Pin105
GPIO36 – Pin106
GPIO37 – Pin103
GPIO38 – Pin96
GPIO39 – Pin114
GPIO40 – Pin115
GPIO41 – Pin116

Methods

Pin.read

Pin.read()

This method reads the pin level.

Return Value:

Pin level. 0 - low level. 1 - high level.

Pin.write

Pin.write(value)

This method sets the pin level.

Note: You need to ensure that the pin is in the output mode before you set the pin level.

Parameter:

  • value - Integer type. Pin level. 0 - low level. 1 - high level.

Return Value:

0 - Successful execution

-1 - Failed execution

Example:

>>> from machine import Pin
>>> gpio1 = Pin(Pin.GPIO1, Pin.OUT, Pin.PULL_DISABLE, 0)
>>> gpio1.write(1)
0
>>> gpio1.read()
1

Pin.set_dir

Pin.set_dir(value)

This method sets I/O mode of the pin.

Parameter:

  • value - Integer type. Pin level. 0 - low level. 1 - high level.

Return Value:

0 - Successful execution

-1 - Failed execution

Pin.get_dir

Pin.get_dir()

This method gets I/O mode of the pin.

Return Value:

I/O mode of pins.

0 - Input mode.

1 - Output mode.

Example:

>>> from machine import Pin
>>> gpio1 = Pin(Pin.GPIO1, Pin.OUT, Pin.PULL_DISABLE, 0)
>>> gpio1.get_dir()
1
>>> gpio1.set_dir(Pin.IN)
0
>>> gpio1.get_dir()
0

Constants

Constant Module Description
Pin.GPIO1 EC600S / EC600N /EC100Y/EC600U/EC200U/EC200A/BC25/EC800N/BG95M3/EC600M/
EG915U/EC800M/EG912N/EG912U/BC32/BC92
GPIO1
Pin.GPIO2 EC600S / EC600N / EC100Y/EC600U/EC200U/EC200A/BC25/EC800N/BG95M3/EC600M/
EG915U/EC800M/EG912N/EG912U/BC32/BC92
GPIO2
Pin.GPIO3 EC600S / EC600N / EC100Y/EC600U/EC200U/EC200A/BC25/EC800N/BG95M3/EC600M/
EG915U/EC800M/EG912N/EG912U/BC32/BC92
GPIO3
Pin.GPIO4 EC600S / EC600N / EC100Y/EC600U/EC200U/EC200A/BC25/EC800N/BG95M3/EC600M/
EG915U/EC800M/EG912N/EG912U/BC32/BC92
GPIO4
Pin.GPIO5 EC600S / EC600N / EC100Y/EC600U/EC200U/EC200A/BC25/EC800N/BG95M3/EC600M/
EG915U/EC800M/EG912N/EG912U/BC32/BC92
GPIO5
Pin.GPIO6 EC600S / EC600N / EC100Y/EC600U/EC200U/EC200A/BC25/EC800N/BG95M3/EC600M/
EG915U/EC800M/EG912N/EG912U/BC32/BC92
GPIO6
Pin.GPIO7 EC600S / EC600N / EC100Y/EC600U/EC200U/EC200A/BC25/EC800N/BG95M3/EC600M/
EG915U/EC800M/EG912N/EG912U/BC32/BC92
GPIO7
Pin.GPIO8 EC600S / EC600N / EC100Y/EC600U/EC200U/BC25/EC800N/BG95M3/EC600M/
EG915U/EC800M/EG912N//EG912U/BC32/BC92
GPIO8
Pin.GPIO9 EC600S / EC600N / EC100Y/EC600U/EC200U/EC200A/BC25/EC800N/BG95M3/EC600M/
EG915U/EC800M/EG912N/BC32/BC92
GPIO9
Pin.GPIO10 EC600S / EC600N / EC100Y/EC600U/EC200U/EC200A/BC25/EC800N/BG95M3/EC600M/
EG915U/EC800M/EG912N/EG912U/BC32/BC92
GPIO10
Pin.GPIO11 EC600S / EC600N / EC100Y/EC600U/EC200U/EC200A/BC25/EC800N/BG95M3/EC600M/
EG915U/EC800M/EG912N/EG912U/BC32/BC92
GPIO11
Pin.GPIO12 EC600S / EC600N / EC100Y/EC600U/EC200U/EC200A/BC25/EC800N/BG95M3/EC600M/EG915U/EC800M/EG912N/EG912U GPIO12
Pin.GPIO13 EC600S / EC600N / EC100Y/EC600U/EC200U/EC200A/BC25/EC800N/BG95M3/EC600M/EG915U/EC800M/EG912N/EG912U GPIO13
Pin.GPIO14 EC600S / EC600N / EC100Y/EC600U/EC200U/BC25/EC800N/BG95M3/EC600M/EG915U/EC800M/EG912N/EG912U GPIO14
Pin.GPIO15 EC600S / EC600N / EC100Y/EC600U/EC200U/BC25/EC800N/BG95M3/EC600M/EG915U/EC800M/EG912N/EG912U GPIO15
Pin.GPIO16 EC600S / EC600N / EC100Y/EC600U/EC200U/BC25/EC800N/BG95M3/EC600M/EG915U/EC800M/EG912N/EG912U GPIO16
Pin.GPIO17 EC600S / EC600N / EC100Y/EC600U/EC200U/EC800N/BC25/BG95M3/EC600M/EG915U/EC800M/EG912N/EG912U GPIO17
Pin.GPIO18 EC600S / EC600N / EC100Y/EC600U/EC200U/EC200A/EC800N/BC25/BG95M3/EC600M/EG915U/EC800M/EG912N/EG912U GPIO18
Pin.GPIO19 EC600S / EC600N / EC100Y/EC600U/EC200U/EC200A/EC800N/BG95M3/EC600M/EG915U/EC800M/EG912N/EG912U GPIO19
Pin.GPIO20 EC600S / EC600N/EC600U/EC200U/EC200A/EC800N/BG95M3/EC600M/EG915U/EC800M/EG912N/EG912U GPIO20
Pin.GPIO21 EC600S / EC600N/EC600U/EC200U/EC800N/BG95M3/EC600M/EG915U/EC800M/EG912N/EG912U GPIO21
Pin.GPIO22 EC600S / EC600N/EC600U/EC200U/EC200A/EC800N/EC600M/EG915U/EC800M/EG912N/EG912U GPIO22
Pin.GPIO23 EC600S / EC600N/EC600U/EC200U/EC800N/EC600M/EG915U/EC800M/EG912N/EG912U GPIO23
Pin.GPIO24 EC600S / EC600N/EC600U/EC200U/EC800N/EC600M/EG915U/EC800M/EG912N/EG912U GPIO24
Pin.GPIO25 EC600S / EC600N/EC600U/EC200U/EC800N/EC600M/EG915U/EC800M/EG912N/EG912U GPIO25
Pin.GPIO26 EC600S / EC600N/EC600U/EC200U/EC800N/EC600M/EG915U/EC800M/EG912N/EG912U GPIO26
Pin.GPIO27 EC600S / EC600N/EC600U/EC200U/EC800N/EC600M/EG915U/EC800M/EG912N/EG912U GPIO27
Pin.GPIO28 EC600S / EC600N/EC600U/EC200U/EC200A/EC800N/EC600M/EG915U/EC800M/EG912N/EG912U GPIO28
Pin.GPIO29 EC600S / EC600N/EC600U/EC200U/EC200A/EC800N/EC600M/EG915U/EC800M/EG912N/EG912U GPIO29
Pin.GPIO30 EC600S / EC600N/EC600U/EC200U/EC200A/EC800N/EC600M/EG915U/EC800M/EG912N/EG912U GPIO30
Pin.GPIO31 EC600S / EC600N/EC600U/EC200U/EC800N/EC600M/EG915U/EC800M/EG912N/EG912U GPIO31
Pin.GPIO32 EC600S / EC600N/EC600U/EC200U/EC800N/EC600M/EG915U/EC800M/EG912N/EG912U GPIO32
Pin.GPIO33 EC600S / EC600N/EC600U/EC200U/EC800N/EC600M/EG915U/EC800M/EG912N GPIO33
Pin.GPIO34 EC600S / EC600N/EC600U/EC200U/EC800N/EC600M/EG915U/EC800M/EG912N/EG912U GPIO34
Pin.GPIO35 EC600S / EC600N/EC600U/EC200U/EC200A/EC800N/EC600M/EG915U/EC800M/EG912N/EG912U GPIO35
Pin.GPIO36 EC600S / EC600N/EC600U/EC200U/EC200A/EC800N/EC600M/EG915U/EC800M/EG912N/EG912U GPIO36
Pin.GPIO37 EC600S / EC600N/EC600U/EC200U/EC800N/EC600M/EG915U/EC800M/EG912N GPIO37
Pin.GPIO38 EC600S / EC600N/EC600U/EC200U/EC600M/EG915U/EC800M/EG912N/EG912U GPIO38
Pin.GPIO39 EC600S / EC600N/EC600U/EC200U/EC600M/EG915U/EC800M/EG912N/EG912U GPIO39
Pin.GPIO40 EC600S / EC600N/EC600U/EC200U/EC600M/EG915U/EC800M/EG912N/EG912U GPIO40
Pin.GPIO41 EC600S / EC600N/EC600U/EC200U/EC600M/EG915U/EC800M GPIO41
Pin.GPIO42 EC600U/EC200U/EC600M/EC800M GPIO42
Pin.GPIO43 EC600U/EC200U/EC200A/EC600M/EC800M GPIO43
Pin.GPIO44 EC600U/EC200U/EC200A/EC600M/EC800M GPIO44
Pin.GPIO45 EC600U/EC200U/EC200A/EC600M GPIO45
Pin.GPIO46 EC600U/EC200U/EC200A GPIO46
Pin.GPIO47 EC600U/EC200U/EC200A GPIO47
Pin.IN -- Input mode
Pin.OUT -- Output mode
Pin.PULL_DISABLE -- Floating mode
Pin.PULL_PU -- Pull-up mode
Pin.PULL_PD -- Pull-down mode