๎๎๎๎ฐ๎ป๎๎๎ด๎๎๎๎๎
๎๎๎๎๎๎ญ๎๎ถ๎๎๎๎๎๎๎๎ UCX series โ User's Manual 79
๎ฅ๎๎๎๎๎๎๎๎๎๎๎๎๎
๎๎๎๎๎
๎๎๎
๎๎๎๎๎๎๎๎๎๎๎๎๎๎ ๎๎ฐ๎จ๎ง๎๎๎๎๎๎๎
๎๎๎๎๎๎๎๎๎๎๎๎
๎๎๎๎๎๎ฃ๎ซ๎ด๎ญ๎ณ๎๎ด๎๎๎๎๎ง๎๎๎ค๎๎๎๎
๎๎๎๎
DIFFERENCE: ๎ ๎ซ๎ด๎ญ๎ณ๎๎๎๎๎
๎๎๎๎๎๎๎๎๎
๎๎๎๎๎
๎๎๎๎
๎๎
๎๎๎
๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎ช๎ป๎๎๎
๎๎๎
๎๎๎๎๎๎๎๎๎๎๎
๎๎๎๎๎๎๎๎ฃ๎ต๎๎๎๎๎๎๎๎๎๎๎๎๎จ๎๎๎๎๎๎๎๎๎๎๎๎๎
๎๎ซ๎ด๎ญ๎ณ๎๎ด๎๎
Command and Response #gpio #new
รง ๎ซ๎ฉ๎ธ๎ธ๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎<port>.Direction
รฆ ๎๎๎ธ๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎<port>.Direction(<dir>)
Parameters
Parameter Parameter description ๎บ๎
๎๎๎ ๎บ๎
๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎
<dir> The direction of the GPIO pin.
Input
input
Output
output
Example
รง ๎ซ๎ฉ๎ธ๎๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎๎ด๎๎๎จ๎๎๎๎๎๎๎๎
รฆ ๎๎๎๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎๎ด๎๎๎จ๎๎๎๎๎๎๎๎๎ก๎ญ๎๎๎๎
๎๎๎๎๎๎๎๎ฃSetting the Direction of a GPIO Pin
Command and Response
รง ๎ท๎ฉ๎ธ๎ธ๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎<port>.Direction(<dir>)
รฆ ๎๎๎ธ๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎<port>.Direction(<dir>)
Parameters
See the previous section.
Example
รง ๎ท๎ฉ๎ธ๎๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎๎ด๎๎๎จ๎๎๎๎๎๎๎๎๎ก๎ญ๎๎๎๎
รฆ ๎๎๎๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎๎ด๎๎๎จ๎๎๎๎๎๎๎๎๎ก๎ญ๎๎๎๎
๎๎๎๎๎๎๎๎ฃ๎ต๎๎๎๎๎๎๎๎๎๎๎๎๎ณ๎๎๎๎๎๎๎ฐ๎๎๎๎๎๎๎๎๎
๎๎ซ๎ด๎ญ๎ณ๎๎ด๎๎
Command and Response
รง ๎ซ๎ฉ๎ธ๎ธ๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎<port>.Output
รฆ ๎๎๎ธ๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎<port>.Output(<value>)
Parameters
Parameter Parameter description ๎บ๎
๎๎๎ ๎บ๎
๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎
<value> The output value of the GPIO pin.
High
high level
Low
low level
Example
รง ๎ซ๎ฉ๎ธ๎๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎๎ด๎๎๎ณ๎๎๎๎๎
รฆ ๎๎๎๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎๎ด๎๎๎ณ๎๎๎๎๎๎ก๎ฐ๎๎
๎๎๎๎๎๎๎๎ฃSetting the Output Level of a GPIO Pin
Command and Response
รง ๎ท๎ฉ๎ธ๎ธ๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎<port>.Output(<value>)
รฆ ๎๎๎ธ๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎<port>.Output(<value>)
Parameters
See the previous section.
Example
รง ๎ท๎ฉ๎ธ๎๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎๎ด๎๎๎ณ๎๎๎๎๎๎ก๎ฌ๎๎๎
รฆ ๎๎๎๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎๎ด๎๎๎ณ๎๎๎๎๎๎ก๎ฌ๎๎๎
๎๎๎๎๎๎๎๎ฃ๎ท๎๎๎๎๎๎๎๎๎๎๎๎ณ๎๎๎๎๎๎๎ฐ๎๎๎๎๎๎๎๎๎๎
๎๎ท๎๎๎๎๎ค๎๎๎๎ธ๎๎๎
Command and Response
รง ๎ง๎ฅ๎ฐ๎ฐ๎ธ๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎<port>:interval(<value>;<time>)
รฆ ๎๎ณ๎ธ๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎<port>:interval=
Parameters
Parameter Parameter description ๎บ๎
๎๎๎ ๎บ๎
๎๎๎๎๎๎๎๎๎๎๎๎๎๎๎
<value> The output value of the GPIO pin.
High
high level
Low
low level
<time> Duration of the desired value in seconds.
1-120
second
Example
รง ๎ง๎ฅ๎ฐ๎ฐ๎๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎๎ด๎๎๎๎๎๎๎๎๎
๎๎๎ฐ๎๎๎๎๎
รฆ ๎๎ณ๎๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎๎ด๎๎๎๎๎๎๎๎๎
๎๎ก
๎๎๎๎๎๎๎๎ฃToggling the Level of a GPIO Pin
The output level can be changed from high to low and low to high by the command below.
Command and Response
รง ๎ง๎ฅ๎ฐ๎ฐ๎ธ๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎<port>:toggle()
รฆ ๎๎ณ๎ธ๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎<port>:toggle
Example
รง ๎ง๎ฅ๎ฐ๎ฐ๎๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎๎ด๎๎๎๎๎๎๎๎๎๎
รฆ ๎๎ณ๎๎๎บ๎๎๎ฑ๎ฉ๎จ๎ญ๎ฅ๎๎ซ๎ด๎ญ๎ณ๎๎ด๎๎๎๎๎๎๎๎