
If a pin is not used for data transmittion, it can be used as an input, output, pulse width modulation (PWM) or analog pin. This feature is available for the WLAN and Logger Module.
Those pins can be controlled using Basic Scripting (described in this article) or the Command Interface (described
here). Choose basic scripting option if the Avisaro Module should perform stand alone functions.
To set an I/O port, use the 'put' command (
more). To read an I/O port, use the 'get' command (
more). There is also the 'setleds' (
more) and the 'key' (
more) command. Do not use those commands- they are there for compability reason only.
There is no need to declare a port as input or output port. By performing a put command, this port is declared as an output port. By performing a get, this port is declared as an input port. By default, a port is an input port.
This script listing is a simple example of how to use I/O ports within Basic. The script turns and off Pin 2 . It reads in Pin4 and sets Pin 3 the same :
' Script to set and read ports
' for demonstration purpose
let in = 0 ' declare variable in
do
put -202, #1 'pin 2: on
'pin 2 is often the red led
'sleep 1 second
sleep 1000
put -202, #0 'pin 2: off
sleep 1000
get -204, in
put -203, in ' set pin 3 same as
' input pin 4
loop
If a pin is not used for data transmittion, this pin can be used as a input, output, pulse width modulation (PWM) or analog pin as described here:
| No | I/O |
Name |
Name |
I/O | No | |
| 1 | P |
VBAT |
|
VCC (3.3V) |
P | 24 |
| 2 | I/O |
GPIO |
n.c. |
- | 23 | |
| 3 | I/O |
GPIO |
n.c. |
- | 22 | |
| 4 | I/O |
GPIO |
n.c. |
- | 21 | |
| 5 | I/O |
GPIO, PWM |
n.c. |
- | 20 | |
| 6 | I/O |
GPIO, PWM |
n.c. |
- | 19 | |
| 7 | I/O |
GPIO, PWM |
n.c. |
- | 18 | |
| 8 | I/O |
GPIO, ADC |
n.c. |
- | 17 | |
| 9 | I/O |
GPIO, PWM, ADC |
I/O (open drain) |
I/O | 16 | |
| 10 | I/O |
GPIO, PWM |
I/O (open drain) |
I | 15 | |
| 11 | I/O |
GPIO, PWM |
Reset |
I | 14 | |
| 12 | I/O |
GPIO |
GND |
P | 13 |
'I/O': pin is input or output or pwm or analog input (ADC), 'p' power, 'n.c.': do not connect, leave open