Daten aus einer serieller Schnittstelle auslesen/auswerten

Welche Warnung sollte da ausgeworfen werden und wann?
Und bis jetzt tut es was es soll, oder Bekomme ich falsche Daten und bemerke es nicht?

Während des kompilieren:

/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino: In function 'void timer_und_ausgeben()':
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:127:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (millis() - myTimer > myTimeout) {
       ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino: In function 'void einlesen()':
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:101:22: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 117: O2 = rs232_inChar;
                   ~~~^~~~~~~~~~~~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:102:9: note: here
         case 118: H2S1 = rs232_inChar;
         ^~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:102:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 118: H2S1 = rs232_inChar;
                   ~~~~~^~~~~~~~~~~~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:103:9: note: here
         case 119: H2S2 = rs232_inChar;
         ^~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:103:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 119: H2S2 = rs232_inChar;
                   ~~~~~^~~~~~~~~~~~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:104:9: note: here
         case 120: H2S3 = rs232_inChar;
         ^~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:104:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 120: H2S3 = rs232_inChar;
                   ~~~~~^~~~~~~~~~~~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:105:9: note: here
         case 121: H21 = rs232_inChar;
         ^~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:105:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 121: H21 = rs232_inChar;
                   ~~~~^~~~~~~~~~~~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:106:9: note: here
         case 122: H22 = rs232_inChar;
         ^~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:106:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 122: H22 = rs232_inChar;
                   ~~~~^~~~~~~~~~~~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:107:9: note: here
         case 123: H23 = rs232_inChar;
         ^~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:107:23: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 123: H23 = rs232_inChar;
                   ~~~~^~~~~~~~~~~~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:108:9: note: here
         case 124: CO21 = rs232_inChar;
         ^~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:108:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 124: CO21 = rs232_inChar;
                   ~~~~~^~~~~~~~~~~~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:109:9: note: here
         case 125: CO22 = rs232_inChar;
         ^~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:109:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 125: CO22 = rs232_inChar;
                   ~~~~~^~~~~~~~~~~~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:110:9: note: here
         case 126: CO23 = rs232_inChar;
         ^~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:110:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 126: CO23 = rs232_inChar;
                   ~~~~~^~~~~~~~~~~~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:111:9: note: here
         case 127: CH41 = rs232_inChar;
         ^~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:111:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 127: CH41 = rs232_inChar;
                   ~~~~~^~~~~~~~~~~~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:112:9: note: here
         case 128: CH42 = rs232_inChar;
         ^~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:112:24: warning: this statement may fall through [-Wimplicit-fallthrough=]
         case 128: CH42 = rs232_inChar;
                   ~~~~~^~~~~~~~~~~~~~
/tmp/arduino_modified_sketch_602499/sketch_feb07a.ino:113:9: note: here
         case 129:
         ^~~~

Dir hat der Compiler vermutlich unter die Arme gegriffen.
Aber ein case ohne break sorgt dafür, das das nächste case ebenfalls ausgeführt wird.
Sowas kann beabsichtigt sein, z.B. wenn ich einen LED-Würfel programmiere, wo die 4 auch in der 5 enthalten ist. In Deinem Fall hätten beim case 117: auch alle folgenden Variablen den selben Inhalt....

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.