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?

[例題の為の例題]分岐させる

Posted at

目的

入力から分岐させる

結果

o_coq964.jpg

プログラム



//input_teset1c_UNO_1


//インクルド
#include <Arduino.h>


//初期化
void setup() {

  //シリアルポートの初期化
  Serial.begin(9600);

  Serial.print("=>");

}  //setup


//メインループ
void loop() {

  if (Serial.available() > 0) {  // 受信したデータが存在する
    char ch1 = Serial.read();    // 受信データを読み込む
    Serial.println(ch1);         // 受信データを送りかえす

    if (ch1 == 'i') {
      Serial.println("!!input");  //debug

    } else if (ch1 == 'l') {
      Serial.println("!!list");  //debug

    } else if (ch1 == 'n') {
      Serial.println("!!new");  //debug

    } else if (ch1 == 'r') {
      Serial.println("!!run");  //debug

    } else if (ch1 == 's') {
      Serial.println("!!save");  //debug

    } else if (ch1 == 'r') {
      Serial.println("!!read");  //debug

    } else if (ch1 == 'b') {
      Serial.println("!!bye");  //debug

    }  //endif

    Serial.print("=>");
  }  //endif

}  //loop


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?