hello_mbot_infrared
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung | ||
hello_mbot_infrared [2025/02/03 15:20] – torsten.roehl | hello_mbot_infrared [2025/02/27 08:36] (aktuell) – [Code extrahieren] torsten.roehl | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== Hello mBot Infrared ====== | ====== Hello mBot Infrared ====== | ||
- | //Dieses Arduino-Programm empfängt Infrarotsignale (IR) vom mBot Infrarot-Empfänger und gibt den erkannten Tastencode und Button-Namen über die serielle Schnittstelle aus. Es verarbeitet Signale von einer IR-Fernbedienung, | + | // |
- | ==== Quellcode (engl. Sourcecode) ==== | + | {{ : |
+ | Die Makeblock IR-Fernbedienung. | ||
+ | |||
+ | ===== Quellcode (engl. Sourcecode) | ||
<Code c linenums:1 | Listing 1: | <Code c linenums:1 | Listing 1: | ||
#include < | #include < | ||
Zeile 24: | Zeile 27: | ||
Serial.print(" | Serial.print(" | ||
switch(value) { | switch(value) { | ||
- | case IR_BUTTON_A: | + | case IR_BUTTON_A: |
- | case IR_BUTTON_B: | + | case IR_BUTTON_B: |
- | case IR_BUTTON_C: | + | case IR_BUTTON_C: |
- | case IR_BUTTON_D: | + | case IR_BUTTON_D: |
- | case IR_BUTTON_E: | + | case IR_BUTTON_E: |
- | case IR_BUTTON_F: | + | case IR_BUTTON_F: |
case IR_BUTTON_SETTING : Serial.println(" | case IR_BUTTON_SETTING : Serial.println(" | ||
- | case IR_BUTTON_LEFT: | + | case IR_BUTTON_LEFT: |
- | case IR_BUTTON_RIGHT: | + | case IR_BUTTON_RIGHT: |
- | case IR_BUTTON_UP: | + | case IR_BUTTON_UP: |
- | case IR_BUTTON_DOWN: | + | case IR_BUTTON_DOWN: |
- | case IR_BUTTON_0: | + | case IR_BUTTON_0: |
- | case IR_BUTTON_1: | + | case IR_BUTTON_1: |
- | case IR_BUTTON_2: | + | case IR_BUTTON_2: |
- | case IR_BUTTON_3: | + | case IR_BUTTON_3: |
- | case IR_BUTTON_4: | + | case IR_BUTTON_4: |
- | case IR_BUTTON_5: | + | case IR_BUTTON_5: |
- | case IR_BUTTON_6: | + | case IR_BUTTON_6: |
- | case IR_BUTTON_7: | + | case IR_BUTTON_7: |
- | case IR_BUTTON_8: | + | case IR_BUTTON_8: |
- | case IR_BUTTON_9: | + | case IR_BUTTON_9: |
default: | default: | ||
} | } | ||
} | } | ||
+ | | ||
} | } | ||
</ | </ | ||
+ | |||
+ | ==== Code extrahieren ==== | ||
+ | |||
+ | Der folgende Code-Snippet extrahiert den // | ||
+ | <Code c linenums:1 | Listing 1: | ||
+ | uint32_t | ||
+ | | ||
+ | value = value >> 16 & 0xff; | ||
+ | | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Die Funktion extrahiert das 3. Byte eines 32-Bit-Werts ('' | ||
+ | |||
+ | |||
hello_mbot_infrared.1738596039.txt.gz · Zuletzt geändert: 2025/02/03 15:20 von torsten.roehl