0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

arduino-cli: Ubuntu で使う

Last updated at Posted at 2025-07-08

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
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?