Endpreise in CHF – Versand inklusive Schweizer Unternehmen · 076 792 63 50 (WhatsApp/SMS)
Kurse › Arduino › Stufe 13
Arduino · Einsteiger · Stufe 13 / 40

C++ for Embedded Work: Structure, Classes and Memory

Organise growing programs with structs, classes and multiple files while keeping RAM use under control.

Einsteiger freischalten · CHF 9.90 Stufen 1–13, einmalig, kein Abo

10 Lektionen in dieser Stufe

  1. Scope, Lifetime and static Local Variables
    Predict where a variable is visible and how long it keeps its value. · Lab: Convert global timestamps into static locals inside task functions.
  2. Fixed-Width Integer Types and Overflow
    Use uint8_t, int16_t and uint32_t deliberately and predict wrap-around. · Lab: Trigger and then fix an overflow in a multiplication of two int values.
  3. Bitwise Operators, Masks and Flags
    Set, clear, toggle and test individual bits. · Lab: Pack eight on-off settings into one byte and print it in binary.
  4. Grouping Related Data with struct
    Define structs and arrays of structs for cleaner data handling. · Lab: Describe each LED channel by a struct of pin, interval and state and loop over an array of them.
  5. Pointers and References Explained with Memory Maps
    Read and write through addresses and choose references for function parameters. · Lab: Write a swap function with references and print the addresses of variables.
  6. Passing Arrays and Structs to Functions
    Hand larger data to functions efficiently and safely with sizes and const. · Lab: Write a function that computes minimum, maximum and mean of any int array.
  7. Classes: Wrapping a Button into a Reusable Object
    Bundle data and behaviour into a class with methods. · Lab: Turn the debounced button code into a Button class with an update and a wasPressed method.
  8. Constructors, Private Members and Multiple Instances
    Initialise objects cleanly and hide internal state. · Lab: Create four Button and four Led objects and connect them in ten lines of loop code.
  9. Splitting a Sketch into Header and Source Files
    Separate declarations from definitions and use include guards. · Lab: Move the classes into their own .h and .cpp tabs and rebuild.
  10. RAM, Flash and the F Macro: Measuring Memory Use
    Distinguish flash, static RAM, stack and heap and keep constant text out of RAM. · Lab: Measure free RAM, move strings to flash with F and PROGMEM and record the gain.

Abschlussprojekt

A multi-file control panel sketch built from reusable Button, Led and Blinker classes that drives four inputs and four outputs with measured RAM use.

Teile für diese Stufe

  • 1 × UNO-compatible board
  • 1 × USB cable matching the board
  • 1 × Solderless breadboard 830 points
  • 1 × Jumper wire set male-male
  • 4 × Tactile push button
  • 4 × LED 5 mm assorted
  • 4 × Resistor 220 ohm

In jeder Lektion legst du die passenden Teile direkt in den Warenkorb. Arduino-kompatibel →

Voraussetzung: Levels 1–12: functions, arrays, state machines and interrupts.

🔒 Sichere Zahlung · 3D Secure 🔐 SSL-verschlüsselt 🚚 Versand in die ganze Schweiz 🇨🇭 Schweizer Unternehmen