Ubuntu 25.04 で確認しました。
ダウンロード
wget https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_64bit.tar.gz
解凍
tar xvfz arduino-cli_latest_Linux_64bit.tar.gz
バージョンの確認
$ ./arduino-cli version
arduino-cli Version: 1.2.2 Commit: c11b9dd5 Date: 2025-04-22T13:51:01Z
ライブラリーのインストール
./arduino-cli core install arduino:avr
ソースコードの作成
hello_world/hello_world.ino
// ---------------------------------------------------------------
/*
hello_world.uno
Jul/08/2025
*/
// ---------------------------------------------------------------
int count = 0;
// ---------------------------------------------------------------
void setup()
{
Serial.begin(19200);
Serial.println("*** start ***");
}
// ---------------------------------------------------------------
void display_proc(char msg[])
{
Serial.print(msg);
Serial.println(" " + String(count));
delay(1000);
}
// ---------------------------------------------------------------
void loop()
{
display_proc("aaaa");
display_proc("bbbb");
display_proc("cccc");
count++;
}
// ---------------------------------------------------------------
コンパイル
./arduino-cli compile --fqbn arduino:avr:uno hello_world
$ ./arduino-cli compile --fqbn arduino:avr:uno hello_world
最大32256バイトのフラッシュメモリのうち、スケッチが3396バイト(10%)を使っています。
最大2048バイトのRAMのうち、グローバル変数が230バイト(11%)を使っていて、ローカル変数で1818バイト使うことができます。
アップロード
./arduino-cli upload -b arduino:avr:uno -p /dev/ttyACM0 hello_world
$ ./arduino-cli upload -b arduino:avr:uno -p /dev/ttyACM0 hello_world
New upload port: /dev/ttyACM0 (serial)
確認
$ cu -s 19200 -l /dev/ttyACM0
Connected.
*** start ***
aaaa 0
bbbb 0
cccc 0
aaaa 1
bbbb 1
cccc 1
aaaa 2
bbbb 2
cccc 2
フォルダー構造
$ tree .
.
├── LICENSE.txt
├── arduino-cli
├── arduino-cli_1.2.2_Linux_64bit.tar.gz
└── hello_world
└── hello_world.ino