0Pricing
Arduino & IoT Academy · درس

ضبط عتبة الإضاءة

حدّد متى يصبح الظلام كافيًا لاتخاذ إجراء بناءً على القراءة.

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

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

Raw Numbers Need Meaning

An analog reading like 312 means nothing on its own. A threshold turns that number into a clear decision: dark or bright.

What a Threshold Is

A threshold is a cutoff value. Readings on one side count as dark, and readings on the other count as bright.

Store It in a Variable

Keep your cutoff in a named variable so it is easy to find and adjust later in one place.

int threshold = 400;

Compare With if

Use an if statement to compare the live reading against your threshold and branch your logic from there.

if (light < threshold) {
  // it is dark
}

Direction Depends on Wiring

Whether dark means a higher or lower number depends on how you wired the divider. Confirm it before you trust the test.

Find Your Number

Print readings in a bright room and a dark one, then pick a midpoint between them as your starting threshold.

Add else for Bright

Pair your if with an else so the bright case is handled too, instead of doing nothing when light is high.

else {
  // it is bright
}

One Cutoff Causes Flicker

Near the line, tiny changes can flip the result back and forth. This rapid flicker looks like a glitch.

Add Hysteresis

Hysteresis uses two cutoffs: one to switch on and a different one to switch off. The gap stops nervous flicker.

Make It Adjustable

Feed the threshold from a potentiometer so anyone can dial in dark without re-uploading code.

Thresholds Drive Decisions

This same threshold idea works for temperature, moisture, and distance. It is how sensors become decisions.

Quick Check

What problem does hysteresis solve at a light threshold?

Recap: Deciding on Light

You stored a threshold, compared readings with if and else, and added hysteresis so the decision stays steady.

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

هل درس «ضبط عتبة الإضاءة» مجاني؟

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

ماذا ستتعلم في «ضبط عتبة الإضاءة»؟

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

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

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

كم من الوقت يستغرق درس «ضبط عتبة الإضاءة»؟

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

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

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

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

  1. قراءة مستشعر الحركة PIR
  2. قياس الضوء باستخدام LDR
  3. ضبط عتبة الإضاءة
  4. مصباح ليلي تلقائي
← العودة إلى Arduino & IoT Academy