質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Arduino

Arduinoは、AVRマイコン、単純なI/O(入出力)ポートを備えた基板、C言語を元としたArduinoのプログラム言語と、それを実装した統合開発環境から構成されたシステムです。

Q&A

解決済

2回答

1831閲覧

Arduinoコンパイラの警告設定について

raspypy

総合スコア247

Arduino

Arduinoは、AVRマイコン、単純なI/O(入出力)ポートを備えた基板、C言語を元としたArduinoのプログラム言語と、それを実装した統合開発環境から構成されたシステムです。

0グッド

0クリップ

投稿2019/03/01 02:57

ハードウェアESP32
開発環境Arduinoです。

Arduinoの"環境設定" の中にある"コンパイラの警告設定"によるエラーの発生有無について。
警告設定を"全て"にすると、エラーが発生しますが、
警告設定を"初期値"にすると、エラーが発生しません。

質問
この場合、コンパイルエラーはないと考えれば良いのでしょうか。
エラーの内容を掲載しますが、内容を理解できません。どのようなエラー内容なのか教えていただけると助かります。

Arduinoのプログラムコードは、次の通りです。
IRRemoteを使用して赤外線通信のテストを行うプログラムです。

html

1#include <IRremote.h> 2IRsend irsend(26); 3 4int khz = 38; 5unsigned int onData[] = {5,5,5}; 6unsigned int offData[] = {6,6,6}; 7 8void setup() { 9 Serial.begin(115200); 10 Serial.println(); 11} 12 13void loop() { 14 if (digitalRead(GPIO_NUM_0) == 0) { 15 irsend.sendRaw(onData, sizeof(onData)/sizeof(int), khz); 16 } else if (digitalRead(GPIO_NUM_15) == 0) { 17 irsend.sendRaw(offData, sizeof(offData)/sizeof(int), khz); 18 } 19}

コンパイラの警告設定"初期値"の場合
なにもエラーは表示されません。

コンパイラの警告設定"全て"の場合
次のエラーが発生します。

html

1C:\Users\xxxxxx\Documents\Arduino\libraries\Arduino-IRremote-master\IRremote.cpp: In function 'int MATCH(int, int)': 2C:\Users\xxxxxx\Documents\Arduino\libraries\Arduino-IRremote-master\IRremote.cpp:58:32: warning: suggest braces around empty body in an 'else' statement [-Wempty-body] 3 DBG_PRINTLN(F("?; FAILED")); 4C:\Users\xxxxxx\Documents\Arduino\libraries\Arduino-IRremote-master\IRremote.cpp: In function 'int MATCH_MARK(int, int)': 5C:\Users\xxxxxx\Documents\Arduino\libraries\Arduino-IRremote-master\IRremote.cpp:84:32: warning: suggest braces around empty body in an 'else' statement [-Wempty-body] 6 7 DBG_PRINTLN(F("?; FAILED")); 8C:\Users\xxxxxx\Documents\Arduino\libraries\Arduino-IRremote-master\IRremote.cpp: In function 'int MATCH_SPACE(int, int)': 9C:\Users\xxxxxx\Documents\Arduino\libraries\Arduino-IRremote-master\IRremote.cpp:110:32: warning: suggest braces around empty body in an 'else' statement [-Wempty-body] 10 DBG_PRINTLN(F("?; FAILED")); 11 12C:\Users\xxxxxx\Documents\Arduino\libraries\Arduino-IRremote-master\IRremote.cpp: In function 'void IRTimer()': 13C:\Users\xxxxxx\Documents\Arduino\libraries\Arduino-IRremote-master\IRremote.cpp:196:24: error: statement has no effect [-Werror=unused-value] 14 15 else BLINKLED_ON() ; // if no user defined LED pin, turn default LED pin for the hardware on 16 17C:\Users\xxxxxx\Documents\Arduino\libraries\Arduino-IRremote-master\IRremote.cpp:198:25: error: statement has no effect [-Werror=unused-value] 18 else BLINKLED_OFF() ; // if no user defined LED pin, turn default LED pin for the hardware on 19 20cc1plus.exe: some warnings being treated as errors 21 22次のフォルダのライブラリArduino-IRremote-masterバージョン2.2.3を使用中:C:\Users\xxxxxx\Documents\Arduino\libraries\Arduino-IRremote-master 23exit status 1 24ボードESP32 Dev Moduleに対するコンパイル時にエラーが発生しました。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

ベストアンサー

warning: suggest braces around empty body in an 'else' statement [-Wempty-body]

コンパイルエラーではなく、警告です
文法に間違いはないけど、バグの可能性があるときに発生します
どういう内容かは、google翻訳などして翻訳させてみればわかるかと思います

まあ、これをエラーとして修正するかどうかはあなた次第でいいんじゃないでしょうか

投稿2019/03/01 03:46

y_waiwai

総合スコア87774

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

IRremote Arduino Library
Supported Boards

ESP32 (receive only)

の注意があります

https://github.com/z3t0/Arduino-IRremote

ESP32 send (送信) は、not supported 対応していません

投稿2019/03/01 03:33

編集2019/03/01 09:02
koujikuu

総合スコア401

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問