0
0

Arduino で HelloWorld

Last updated at Posted at 2021-08-15

Arduino で Hello World を行う方法です。
ボーレートは 19200 にしました。

シリアルモニタに次の表示を出します。
arduino_aa.png

Arduino IDE の画面

arduino_bb.png

プログラム

hello_world/hello_world.ino
// ---------------------------------------------------------------------
/*
	hello_world.ino

						Aug/15/2021
*/
// ---------------------------------------------------------------------
int count = 0;

void setup()
{
	// put your setup code here, to run once:

	Serial.begin(19200);
	Serial.println("*** start ***");
}

// ---------------------------------------------------------------------
void loop() 
{
	Serial.println("Hello World! " + String(count));
	delay(1000);
	Serial.println("Good Morning! " + String(count));
	delay(1000);
	Serial.println("こんにちは " + String(count));
	delay(1000);
	count++;
}

// ---------------------------------------------------------------------

Arduino にプログラムを書き込んだあと、端末と通信する方法

image.png

$ cu -s 19200 -l /dev/ttyACM0
Connected.
*** start ***
Hello World! 0
Good Morning! 0
こんにちは 0
Hello World! 1
Good Morning! 1
こんにちは 1
Hello World! 2
Good Morning! 2
こんにちは 2
Hello World! 3
cu: Got hangup signal

cu: Got hangup signal は、USB を端末から抜いたことで発生しています。

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