LoginSignup
0
0

ArduinoUno: シリアルモニタを使う

Last updated at Posted at 2021-07-19

Arduino のシリアルモニタを使う方法です。
こちらのプログラムを改造しました。
Arduino: LCD モジュールを使う

greetings/greetings.ino
#include "rgb_lcd.h"

rgb_lcd lcd;
int count = 0;

void setup() {
	lcd.begin(16,2);
	lcd.setRGB(0, 255, 255);
  Serial.begin(9600);
  Serial.println("*** start ***");

}

void loop() {
    lcd.setCursor(0,0);
    lcd.print ("Good Morning!  ");
    Serial.println("AAA " + String(count));
    delay(2000);
    count++;
    lcd.setCursor(0,0);
    lcd.print ("Good Afternoon!  ");
    Serial.println("BBB " + String(count));
    delay(2000);
    count++;
    lcd.setCursor(0,0);
    lcd.print ("Good Evening!  ");
    Serial.println("CCC " + String(count));
    delay(2000);
    count++;
}

Arduino IDE で
ツール -> シリアルモニタで、シリアルモニタが表示されます。

ボーレートは 9600 です。

実行結果
image.png

次のエラーが出た場合は、

ボード/dev/ttyACM0は利用できません
シリアルポート「/dev/ttyACM0」を開く際にエラーが発生しました。


パーミッションを変更して下さい。

>```bash
sudo chmod 777 /dev/ttyACM0
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