Arduinoとシリアル通信する方法
ArduinoでPCとのシリアル通信する場合、USBケーブルで接続します。
Contents
Arduinoでシリアル通信するスケッチ
以下のコードはシリアル通信で"テスト"を1秒おきに出力するスクリプトです。
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);// 9600bpsで通信開始
}
void loop() {
// put your main code here, to run repeatedly:
Serial.println("テスト");//"テスト"を出力し、改行する
delay(1000);//1秒間待機
}
実行すると以下のようになります。
受信側の速度も9600bpsに合わせてください。

ディスカッション
コメント一覧
まだ、コメントがありません