Einführung in die Programmierung von Raspberry Pi Pico Mikrocontrollern mit C++
$15.00
Minimum price
$25.00
Suggested price

Einführung in die Programmierung von Raspberry Pi Pico Mikrocontrollern mit C++

About the Book

Dieses Buch ist eine Einführung in die Programmierung von Raspberry Pi Pico Mikrocontrollern mit C++. Es zeigt die Grundlagen an vielen Beispielen, die als lauffähige Programme im wokwi-Simulator ohne Hardware, Löten und Kurzschlüsse verfügbar sind. Links und weitere Informationen finden Sie auf

https://www.rkaiser.de/embedded-cpp-books

About the Author

Table of Contents

1 Mikrocontroller und Embedded Systeme 1 1.1 Verbreitete Microcontroller Boards 3 1.2 Einsatzbereiche und spezielle Anforderungen 3 1.3 C und C++ 7 2 Entwicklungsumgebungen 9 2.1 Unterschiede der Entwicklungsumgebungen 11 2.2 Projekte mit dem Wokwi-Simulator 12 2.2.1 Fertige Wokwi-Projekte 12 2.3 Projekte mit der Arduino IDE 15 2.3.1 Die Installation der Arduino-IDE 15 2.3.2 Projekte anlegen 16 2.3.3 Pakete für weitere Boards installieren 17 2.4 Projekte mit Visual Studio und der VisualMicro Extension 18 2.4.1 Die Installation der VisualMicro Extension in Visual Studio 18 2.4.2 Ein Mikrocontroller-Projekt anlegen 20 2.4.3 Das Board auswählen 21 2.4.4 Board-Updates manuell installieren 24 2.5 Dokumentation 25 2.6 Compiler-Einstellungen Ө 25 2.7 Einige Elemente der Visual Studio und VS Code IDE Ө 27 2.7.1 Tastenkombinationen 27 2.7.2 Intellisense 28 2.7.3 Definitionen einsehen 29 2.7.4 Symbole suchen 30 2.7.5 Namen umbenennen 31 2.7.6 Zeichenfolgen suchen und ersetzen 32 2.7.7 Projektmappen-Explorer 33 2.8 Visual Studio Code Extensions 33 3 Projekte für Digital- und Analog-I/O 35 3.1 Projekte für Raspberry Pi Pico Boards 36 3.1.1 Die Hardware 36 3.1.2 Die serielle Schnittstelle auswählen 37 3.2 Die setup, loop und main Funktionen 39 3.2.1 Einfache Meldungen über die serielle Konsole ausgeben 40 3.2.2 Ein Programm auf den Mikrocontroller hochladen und ausführen 41 3.2.3 Fehler beim Kompilieren 42 3.2.4 Die Funktion setup_serial_port 43 3.2.5 Anweisungen zur Ausgabe von Daten über die serielle Konsole 44 3.2.6 Die main-Funktion 46 3.3 Elektrische Grenzwerte beachten 47 3.4 Digital I/O 47 3.4.1 Anweisungen für Digital I/O 48 3.4.2 Digital Output: Beispiel blinkende LED 49 3.4.3 Digital Output: Beispiel Ampelsteuerung 51 3.4.4 Digital Output: Ampelsteuerung mit einem Zustandsautomaten 54 3.4.5 Digital Input: Beispiel Druckschalter abfragen 56 3.4.6 Digital Input: Externe Interrupts 58 3.4.6.1 Beispiele für Anwendungen von externen Interrupts 62 3.4.7 Digital I/O: Analoge Werte mit einem Abstandssensor 62 3.5 Analog Input: AD-Wandler 65 3.5.1 Analog Input: Potentiometer lesen 67 3.5.2 Rohwerte und physikalische Werte umrechnen 68 3.5.3 Analog Input: Beispiel Spannungen (Volt) und Temperaturwerte 70 3.5.4 Analoge Eingänge mit mocking testen 71 3.6 Analog Output 72 3.6.1 Analoge Ausgabe mit Pulsweitenmodulation (PWM) 72 3.6.2 Töne erzeugen 75 3.6.3 Analog Output mit einem DA-Wandler 79 3.7 Timer Interrupts 79 3.8 Pin-Layout Raspberry Pi Pico 81 3.8.1 Onboard LEDs und Onboard PushButtons 82 3.8.2 Stromversorgung 82 3.8.3 Pins, die man normalerweise nicht verwenden sollte 82 3.9 Das Raspberry Pi Pico SDK Ө 83 3.9.1 Die setup und loop Funktionen 84 3.9.2 Ausgabefunktionen 84 3.9.3 Zeitfunktionen 84 3.9.4 Digital I/O GPIO 85 3.9.5 Analog Input 87 3.9.6 PWM Analog Output 88 3.9.7 Free RTOS 89 4 Elementare C++-Grundlagen 91 4.1 Variablen und Bezeichner 91 4.1.1 Bezeichner und Schlüsselwörter 93 4.1.2 Globale und lokale Variablen 93 4.1.3 Die Ausgabe mit std::cout und std::print 94 4.1.4 Die Initialisierung von Variablen bei ihrer Definition 98 4.1.5 volatile Variablen Ө 99 4.2 Ganzzahldatentypen 100 4.2.1 Ganzzahlliterale und ihr Datentyp 102 4.2.2 Typ-Inferenz: Implizite Typzuweisungen mit auto 103 4.2.3 Initialisierungslisten und Konversionen 105 4.2.4 Zuweisungen und Standardkonversionen bei Ganzzahlausdrücken Ө 108 4.2.5 Operatoren und die „üblichen arithmetischen Konversionen“ 108 4.2.6 Die Inkrement- und Dekrementoperatoren 109 4.2.7 Bitoperationen 110 4.2.8 Die Datentypen char und wchar_t 112 4.2.9 Der Datentyp bool 115 4.3 Kontrollstrukturen 120 4.3.1 Die if- und die Verbundanweisung 120 4.3.1.1 Die Bedingung in einer if-Anweisung 120 4.3.1.2 Die Verbundanweisung 120 4.3.1.3 Verschachtelte if-Anweisungen 122 4.3.2 Die switch-Anweisung 123 4.3.3 Die for-, die while- und die do-Schleife 126 4.4 Funktionen und der Datentyp void 129 4.4.1 Die Definition von Funktionen 129 4.4.2 Der Rückgabetyp void 130 4.4.3 Der Rückgabetyp auto 130 4.4.4 Design von Funktionen 131 4.4.5 Wert- und Referenzparameter 133 4.4.6 Default-Argumente 134 4.4.7 Funktionszeiger: Datentypen für Funktionen 137 4.5 Namensbereiche – Grundlagen 139 4.5.1 Die Verwendung von Bibliotheken und Namensbereichen 143 4.6 Gleitkommadatentypen 147 4.6.1 Die interne Darstellung von Gleitkommawerten 147 4.6.2 Der Datentyp von Gleitkommaliteralen 150 4.6.3 Standardkonversionen 151 4.6.4 Mathematische Funktionen 156 4.6.5 Lineare Transformationen der Werte von AD- und DA-Wandlern 157 4.7 Konstanten 160 4.7.1 Laufzeitkonstanten mit const 161 4.7.2 Compilezeit-Konstanten mit constexpr 162 4.7.3 constexpr Funktionen 164 4.8 Strings 167 4.8.1 Die Definition von Variablen eines Klassentyps 168 4.8.2 Einige Elementfunktionen der Klasse string 170 4.8.3 Stringkonversionen 178 4.8.3.1 Die C-Konversionsfunktionen 179 4.8.3.2 C++11-Konversionsfunktionen: to_string, stoi usw. 179 4.9 Kommentare 180 4.10 Exception-Handling Grundlagen: try, catch und throw 182 4.10.1 Exceptions abfangen 182 4.10.2 Exception-Handling aktivieren 185 4.10.3 try-catch: Der Programmablauf an einem einfachen Beispiel 186 4.10.4 Exceptions mit throw auslösen 188 4.10.5 noexcept 189 4.11 Präprozessordirektiven 189 4.11.1 Die #include-Direktive 190 4.11.2 Makros Ө 191 4.11.3 Bedingte Kompilation 193 Literaturverzeichnis 199 Index 201

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub