0Pricing
Arduino & IoT Academy · Lesson

int, float, bool on Arduino

Pick the right type to hold sensor data and flags.

int, float, bool on Arduino is a free Arduino & IoT Academy lesson on CoddyKit — lesson 1 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Arduino & IoT Academy learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

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. 🎯

Frequently asked questions

Is the “int, float, bool on Arduino” lesson free?

Yes — the full text of “int, float, bool on Arduino” is free to read here on the web, and the Arduino & IoT Academy course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Arduino & IoT Academy course, upgrade to CoddyKit PRO.

What will I learn in “int, float, bool on Arduino”?

Pick the right type to hold sensor data and flags. You practise Arduino & IoT Academy with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Arduino & IoT Academy?

No prior experience is required. Arduino & IoT Academy on CoddyKit is structured for beginners through advanced learners; this is — lesson 1 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “int, float, bool on Arduino” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Arduino & IoT Academy lesson?

Yes. Every Arduino & IoT Academy lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. int, float, bool on Arduino
  2. Why delay() Blocks Everything
  3. Blink Without delay Using millis
  4. Run Two Things at Once
← Back to Arduino & IoT Academy