Arduino で Hello World を行う方法です。
ボーレートは 19200 にしました。
Arduino IDE の画面
プログラム
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 にプログラムを書き込んだあと、端末と通信する方法
$ 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 を端末から抜いたことで発生しています。