Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESP8266のOverflowを調査 #39

Open
hiyanaka opened this issue Jun 21, 2017 · 5 comments
Open

ESP8266のOverflowを調査 #39

hiyanaka opened this issue Jun 21, 2017 · 5 comments

Comments

@hiyanaka
Copy link
Contributor

hiyanaka commented Jun 21, 2017

背景

ESP8266がOverflowを起こさないようにする。

目的

ESP8266が文字列を送った時に、Overflowを起こすかを調査

対応内容

  • Overflowを起こすのであれば対処法を調査し、ここに残す
  • オーバーフローを発生させる検証

期日

6/23

@hiyanaka
Copy link
Contributor Author

@hiyanaka
Copy link
Contributor Author

@makki0205 makki0205 reopened this Jun 28, 2017
@hiyanaka
Copy link
Contributor Author

hiyanaka commented Jul 4, 2017

/***
/* 文字列をシリアル通信で送信し、格納データを表示するプログラム
/***
char input[30];   // 文字列格納用
int i = 0;  // 文字数のカウンタ
   
void setup() {
  Serial.begin(9600);
}
   
void loop() {
  
  // データ受信したとき
  if (Serial.available()) {
    input[i] = Serial.read();
     // 文字数が30以上 or 末尾文字
    if (i > 30 || input[i] == '.') {
      // 末尾に終端文字の挿入
      input[i] = '\0';
      // 受信文字列を送信
      Serial.write(input);
      Serial.write("\n");
      // 格納されたデータ数を表示
      Serial.println(i);
    }
    else { i++; }
  }
}

@hiyanaka
Copy link
Contributor Author

hiyanaka commented Jul 4, 2017

overflow

@hiyanaka
Copy link
Contributor Author

hiyanaka commented Jul 4, 2017

対処法

  • 送信後のデータを初期化する前に別の配列に格納して残す必要性がある?

@hiyanaka hiyanaka assigned makki0205 and unassigned hiyanaka Jul 4, 2017
@hiyanaka hiyanaka closed this as completed Jul 6, 2017
@hiyanaka hiyanaka reopened this Jul 12, 2017
@makki0205 makki0205 removed their assignment Aug 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants