int, float, bool auf Arduino
Wählen Sie den passenden Datentyp für Sensordaten und Statusflags.
int, float, bool auf Arduino ist eine kostenlose Arduino & IoT Academy-Lektion auf CoddyKit. Dies ist Lektion 1 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Arduino & IoT Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Arduino & IoT Academy-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
Boxes for Your Data
A variable is a named box that holds a value while your sketch runs, so you can store a sensor reading once and reuse it later. 📦
Why Types Matter
On Arduino you must say what kind of value a box holds. The type decides how much memory it takes and what values fit inside it.
Whole Numbers with int
An int stores whole numbers like counts, pin numbers, or a 0 to 1023 sensor value. It is the type you will reach for most often.
int sensorValue = 512;int Has Limits
On an Uno an int holds roughly -32,768 to 32,767. Go past that and the number wraps around, which can cause sneaky bugs.
Decimals with float
A float holds numbers with a decimal point, like 23.5 degrees from a temperature sensor. Use it when whole numbers are too coarse.
float temperature = 23.5;float Is Approximate
A float trades exactness for range, so values are stored approximately. Avoid it for money or precise counting; it is great for sensors.
True or False with bool
A bool holds just true or false, perfect for a yes or no fact like whether a button is currently pressed or an LED is on.
bool ledOn = false;Name It Clearly
Give each variable name a clear meaning like buttonPin or doorOpen. Future you reads code faster when names say what they hold.
Declare Then Use
First you declare a variable with its type and a name, then you can read it or change it anywhere below in the same sketch.
int count = 0;
count = count + 1;Global vs Local
Declare a variable above setup to make it global and shared everywhere. Declare it inside a function and only that function can see it.
Pick the Right Type
Match the type to the data: int for counts and pins, float for temperatures, bool for flags. The right choice saves memory and prevents bugs.
Quick Check
Which type best stores a temperature reading of 23.5 degrees?
Recap
You now pick types like a pro: int for whole numbers, float for decimals, and bool for true or false flags. Clear names keep it all readable. 🎯
Häufig gestellte Fragen
Ist die Lektion „int, float, bool auf Arduino“ kostenlos?
Ja — der vollständige Text von „int, float, bool auf Arduino“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Arduino & IoT Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Arduino & IoT Academy-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „int, float, bool auf Arduino“?
Wählen Sie den passenden Datentyp für Sensordaten und Statusflags. Du übst Arduino & IoT Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Arduino & IoT Academy zu starten?
Keine Vorkenntnisse erforderlich. Arduino & IoT Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 1 von 4.
Wie lange dauert die Lektion „int, float, bool auf Arduino“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Arduino & IoT Academy-Lektion Code schreiben und ausführen?
Ja. Jede Arduino & IoT Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- int, float, bool auf Arduino
- Warum delay() alles blockiert
- Blinken ohne delay mit millis
- Zwei Dinge gleichzeitig ausführen