0Pricing
Arduino & IoT Academy · درس

int وfloat وbool على Arduino

اختر النوع المناسب لحفظ بيانات المستشعرات وأعلام الحالة.

int وfloat وbool على Arduino درس مجاني في Arduino & IoT Academy على CoddyKit. هذا هو الدرس 1 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Arduino & IoT Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Arduino & IoT Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

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

الأسئلة الشائعة

هل درس «int وfloat وbool على Arduino» مجاني؟

نعم — نص درس «int وfloat وbool على Arduino» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Arduino & IoT Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Arduino & IoT Academy 4 دروس في المجموع.

ماذا ستتعلم في «int وfloat وbool على Arduino»؟

اختر النوع المناسب لحفظ بيانات المستشعرات وأعلام الحالة. تتمرن على Arduino & IoT Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Arduino & IoT Academy؟

لا تُشترط خبرة سابقة. Arduino & IoT Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 1 من أصل 4.

كم من الوقت يستغرق درس «int وfloat وbool على Arduino»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Arduino & IoT Academy هذا؟

نعم. كل درس في Arduino & IoT Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. int وfloat وbool على Arduino
  2. لماذا تحجب delay() كل شيء
  3. الوميض دون delay باستخدام millis
  4. تشغيل مهمتين في الوقت نفسه
← العودة إلى Arduino & IoT Academy