hello_mbot_bluetooth
                Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
| Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
| hello_mbot_bluetooth [2025/02/03 15:26] – angelegt torsten.roehl | hello_mbot_bluetooth [2025/02/05 11:01] (aktuell) – [Hello mBot Bluetooth] torsten.roehl | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| ====== Hello mBot Bluetooth ====== | ====== Hello mBot Bluetooth ====== | ||
| + | |||
| + | Dieses Arduino-Programm ermöglicht die Steuerung der **mBot-LEDs über Bluetooth**. | ||
| + | Über ein **Bluetooth-Terminal** (z. B. '' | ||
| + | kann der mBot Befehle empfangen und die **LEDs in verschiedenen Farben schalten**. | ||
| + | |||
| + | |||
| + | <WRAP center round info 95%> | ||
| + | **Wozu Bluetooth? | ||
| + | |||
| + | |||
| + | Sobald Bluetooth für den **mBot** verfügbar ist, eröffnet es eine Vielzahl von Steuerungs- und Regelungsaufgaben. Die **mBots** können sowohl untereinander als auch über einen PC (Android, Linux) gesteuert werden oder in Gruppen agieren. Dies schafft zahlreiche interessante Anwendungsmöglichkeiten. 8-) | ||
| + | |||
| + | </ | ||
| + | |||
| + | <WRAP center round important 90%> | ||
| + | **Bluetooth mit **mBot** ist aufgrund der //" | ||
| + | - Beim **mBot** teilen sich die USB-Verbindung und das Bluetooth-Modul (welches aufgesteckt wird) die __gleiche Hardware__. Das bedeutet, dass bei einer USB-Verbindung (USB-Kabel steckt) Bluetooth nicht genutzt werden kann! | ||
| + | - Die Klasse `MeBluetooth` in der API oder `SoftwareSerial` sind __nicht__ für den **mBot** zuständig. | ||
| + | - Die Programmierung ist identisch mit der Programmierung der seriellen Schnittstelle, | ||
| + | - Das Gerät muss mit den richtigen '' | ||
| + | |||
| + | </ | ||
| + | |||
| + | |||
| ==== Quellcode (engl. Sourcecode) ==== | ==== Quellcode (engl. Sourcecode) ==== | ||
| <Code c linenums:1 | Listing 1: | <Code c linenums:1 | Listing 1: | ||
| + | #include < | ||
| + | MeRGBLed led(0, 2); // LED-Modul am mBot | ||
| + | void setup() { | ||
| + | Serial.begin(115200); | ||
| + | led.setpin(13); | ||
| + | led.setColor(0, | ||
| + | led.show(); | ||
| + | } | ||
| + | |||
| + | void loop() { | ||
| + | if (Serial.available()) { | ||
| + | char cmd = Serial.read(); | ||
| + | |||
| + | switch (cmd) { | ||
| + | case ' | ||
| + | led.setColor(0, | ||
| + | led.setColor(1, | ||
| + | break; | ||
| + | case ' | ||
| + | led.setColor(0, | ||
| + | led.setColor(1, | ||
| + | break; | ||
| + | case ' | ||
| + | led.setColor(0, | ||
| + | led.setColor(1, | ||
| + | break; | ||
| + | case ' | ||
| + | led.setColor(0, | ||
| + | led.setColor(1, | ||
| + | break; | ||
| + | default: // unknown command ...do nothing | ||
| + | return; | ||
| + | } | ||
| + | led.show(); | ||
| + | delay(50); | ||
| + | } | ||
| + | } | ||
| </ | </ | ||
| + | |||
| + | |||
| + | **Erlaubte Befehle: | ||
| + | * ''' | ||
| + | * ''' | ||
| + | * ''' | ||
| + | * ''' | ||
| + | |||
| + | |||
| + | ===== Verbindung des mBot über Bluetooth ===== | ||
| + | |||
| + | - Den **Code auf den mBot hochladen** (über USB mit der Arduino IDE). | ||
| + | - Das **<color # | ||
| + | - Den **mBot** neu starten. | ||
| + | - Den **mBot mit einem Bluetooth-Terminal verbinden**: | ||
| + | - **Android**: | ||
| + | - **Linux**: '' | ||
| + | - Einen der folgenden Befehle senden: | ||
| + | - **'' | ||
| + | - **'' | ||
| + | - **'' | ||
| + | - **'' | ||
| + | |||
| + | Nach erfolgreicher Verbindung können die **LEDs über Bluetooth gesteuert werden**. 🚀 | ||
| + | |||
| + | ====  Bluetooth Verbindung herstellen | ||
| + | |||
| + | * [[Bluetooth-Verbindung mit Android]] | ||
| + | * [[Bluetooth-Verbindung mit Linux]] | ||
hello_mbot_bluetooth.1738596377.txt.gz · Zuletzt geändert:  von torsten.roehl
                
                