User manual

UDOO Starting manual (beta) Version 0.4
http://www.udoo.org/
27"
5. Shared GPIOs Management
5.1. Introduction
In this chapter it will be described how UDOO manages the signals available on
external pin header, and the way to control all the GPIOs. On UDOO, Freescale i.MX
and Atmel SAM3X8E share most of the GPIOs available on external pin headers.
Each pin of both processors can be set in INPUT or OUTPUT mode.
In INPUT mode, each processor read the electrical level of the signal.
In OUTPUT mode they can drive low or high the voltage level on each pin.
So both processors can control all digital external pins.
Usually, with Arduino Due, applications that manage external pins are developed to
run on the SAM3x8E microcontroller. On UDOO it is possible to control external pins
also using i.MX6 processor.
5.2. SAM3x8E GPI/Os management
SAM3x8E microcontroller can manage GPIOs using classic Arduino programming
language. More information on this topic can be found at
http://arduino.cc/en/Reference/HomePageTo manage a GPIO it is necessary to set
its direction (input or output) by calling the pinMode(pin, mode) function.
e.g. pinMode(2, INPUT ); pinMode(2, OUTPUT );
If pin is set in input mode, its value can be read by using the function
digitalRead(pin) providing pin number as parameter:
e.g. int val = digitalRead(2);
If pin is set in output mode, its value can be written by using the function
digitalWrite(pin, value)providing the pin number and the value that must be written
as parameters:
e.g. digitalWrite (2, HIGH) ; digitalWrite (2, LOW);