Generally, Arduino APIs are used for a microcontroller like Arduino-UNO, esp8266, etc. To make it easier for people who have used Arduino to control their Odroid GPIO, I developed Arduino API for Odroid.
There is no need to install Arduino IDE on your PC and you don’t need to connect the PC to Odroid. Install Arduino IDE and some dependencies into Odroid and write code. When you upload the code, Odroid runs the code on its own.
Github: https://github.com/hhk7734/oduino
Installation
OS
Supports Ubuntu MATE desktop.
Installation Guide and OS download link: https://wiki.odroid.com/getting_started ... tion_guide
Arduino IDE
- Download latest Arduino IDE for the Linux ARM from https://www.arduino.cc/en/Main/Software
- Installation Guide: https://www.arduino.cc/en/Guide/Linux
Open a terminal and execute the following command (copy and paste the command to the terminal):
Code: Select all
sudo apt update \
&& sudo apt install -y git \
&& git clone --recursive https://github.com/hhk7734/oduino.git \
~/Arduino/hardware/hardkernel/odroid \
&& sudo ~/Arduino/hardware/hardkernel/odroid/tools/install.sh
odroid-config(optional)
Github: https://github.com/hhk7734/odroid-config
Odroid-config is a utility that helps users configure odroid easily.
Arduino IDE Setup
- Tools -> Board -> ODROID Series
- Tools -> Port -> /dev/ttyHK0
- Tools -> Programmer -> Bridge
Arduino for Odroid use physical location based pinmap. If you have Odroid-N2, the pinmap is shown in the table below.
Code: Select all
+---------+------+---+--- N2 ---+---+------+---------+
| Name | Mode | V | Physical | V | Mode | Name |
+---------+------+---+----++----+---+------+---------+
| 3.3V | | | 1 || 2 | | | 5V |
| SDA.2 | ALT1 | 1 | 3 || 4 | | | 5V |
| SCL.2 | ALT1 | 1 | 5 || 6 | | | 0V |
| IO.473 | ALT1 | 0 | 7 || 8 | 1 | IN | TxD1 |
| 0V | | | 9 || 10 | 1 | IN | RxD1 |
| IO.479 | IN | 1 | 11 || 12 | 1 | IN | IO.492 |
| IO.480 | IN | 1 | 13 || 14 | | | 0V |
| IO.483 | IN | 1 | 15 || 16 | 1 | IN | IO.476 |
| 3.3V | | | 17 || 18 | 1 | IN | IO.477 |
| MOSI | IN | 1 | 19 || 20 | | | 0V |
| MISO | IN | 1 | 21 || 22 | 1 | IN | IO.478 |
| SCLK | IN | 1 | 23 || 24 | 1 | IN | CE0 |
| 0V | | | 25 || 26 | 0 | IN | IO.464 |
| SDA.3 | ALT2 | 1 | 27 || 28 | 1 | ALT2 | SCL.3 |
| IO.490 | IN | 1 | 29 || 30 | | | 0V |
| IO.491 | IN | 1 | 31 || 32 | 0 | IN | IO.472 |
| IO.481 | IN | 1 | 33 || 34 | | | 0V |
| IO.482 | IN | 0 | 35 || 36 | 0 | IN | IO.495 |
| AIN.3 | | | 37 || 38 | | | 1V8 |
| 0V | | | 39 || 40 | | | AIN.2 |
+---------+------+---+----++----+---+------+---------+
| Name | Mode | V | Physical | V | Mode | Name |
+---------+------+---+--- N2 ---+---+------+---------+
Arduino IDE -> File -> Examples -> 01.Basics -> Blink
Code: Select all
void setup() {
pinMode(LED_BUILTIN, OUTPUT);
}
void loop() {
digitalWrite(LED_BUILTIN, HIGH);
delay(1000);
digitalWrite(LED_BUILTIN, LOW);
delay(1000);
}
constexpr int LED_BUILTIN = 13;
is declared.Connect the LED to the 13-pin and upload the example code, the LED will blink.
