The Digital I/O API is one of the fundamental LinkIt APIs; with other APIs and function libraries being based on it (such as Advanced I/O, SPI, I2C and UART). It? used to transmit digital signals, and complements the Analog I/O API that processes analog signals.
Digital signals have two states, high (3.3V) and low (0V), indicated by static variables HIGH and LOW.
There are 16 pins on LinkIt ONE available for digital I/O; some of the pins can be shared with other APIs (see Table below). In most cases, when you use digital I/O pins, you combine several pins together, constructing a port to communicate with a peripheral.
Table: Digital I/O pins are listed
|
Board |
Pins |
|
LinkIt ONE |
D0 ~ D13 SDA/SCL or D18/D19 (shared with Wire/I2C) |
Before using a digital I/O pin, you must set its pin mode. Failure to set the correct mode can result in unexpected behaviour. The default pin mode is INPUT. For details, refer to pinMode() in the MediaTek LinkIt API reference
|
Function |
Description |
|
Reads voltage of assigned pin, HIGH or LOW. There are 16 pins on LinkIt ONE used as digital I/O, they are D0 ~ D13 and D18/D19, particularly D18/D19 are shared with Wire/I2C. | |
|
Sets assigned pins to high voltage (3.3V) or low voltage (0V). There are 16 pins on LinkIt ONE used as digital I/O, they are D0 ~ D13 and D18/D19, particularly D18/D19 are shared with Wire/I2C. | |
|
Sets up modes for assigned pins. There are 16 pins on LinkIt ONE used as digital I/O, they are D0 ~ D13 and D18/D19, particularly D18/D19 are shared with Wire/I2C. LinkIt One supports 3 pin modes:
|