Laird WB45NBT
Reference Guide
Embedded Wireless Solutions Support Center:
http://ews-support.lairdtech.com
www.lairdtech.com/wi-fi
28
© Copyright 2016 Laird. All Rights Reserved
Americas: +1-800-492-2320
Europe: +44-1628-858-940
Hong Kong: +852 2923 0600
Name
Linux ID
LED
Header Pin
Port
Comments
IRQ/SW1
50
N/A
X
pc18
Use in Linux
Linux uses a standard GPIO library and all the GPIOs can be accessed via the sysfs interface. To use a GPIO, you must
first export it. It is exported to /sys/class/gpio/name/.
To work with a pin as an output, follow these steps:
1.
Export the pin.
2.
Set its direction as an output.
3.
Set it to the desired value.
To work with the pin as an input, follow these steps:
1.
Export the pin.
2.
Set its direction as an input.
Note: These are set as inputs by default so this step is likely unnecessary.
3.
Read value.
For example, to change GPIO3 to an output and set it high:
# cd /sys/class/gpio
# echo 75 > export
# echo 'out' > pioC11/direction
# echo '1' > pioC11/value
# cat pioC11/value
1
Note: GPIOs are set as inputs by default. The
value reflects the input value on the pin.
export
# echo 75 > export
set input
# echo 'in' > pioC11/direction
read input value
This must be first set as input.
# cat pioC11/value
0
set output