0Pricing
Arduino & IoT Academy · درس

تخزين الرفعات وتجميعها

خزّن البيانات دون اتصال وزامنها عند عودة WiFi.

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

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

WiFi Isn't Always There

Real devices lose their connection: the router reboots, the signal drops, the cloud blips. A good logger keeps working when the network disappears. 📶

Don't Drop Data

If you only send readings live, an outage means lost samples forever. The fix is to store offline first, then upload once the network returns.

What a Buffer Is

A buffer is a temporary holding area for data waiting to be sent. Your readings queue up there safely until an upload can happen.

Where to Buffer

For a few values, an array in RAM works. For many that must survive resets, buffer to an SD card file or flash instead.

What Batching Means

Batching means sending many readings in one request instead of one at a time. Fewer connections save power and play nicely with the cloud.

The Save-Then-Send Loop

The pattern is simple: always save a reading to the buffer, and only try to upload when WiFi is connected.

save(reading);
if (WiFi.status() == WL_CONNECTED) upload();

Check the Connection

Before every upload, confirm you are online. Skipping this check makes your code hang or throw errors during an outage.

if (WiFi.status() != WL_CONNECTED) return;

Send the Whole Batch

When online, package the queued readings, often as a JSON array, and POST them together in a single batch request.

POST /readings  [ {...}, {...}, {...} ]

Clear Only on Success

Delete buffered data only after the server confirms it. If the upload fails, keep the data and retry next time.

Watch the Memory

A growing buffer can overflow RAM. Cap its size, or write to storage, so a long outage never crashes the device.

Back Off on Failure

If uploads keep failing, wait longer between tries. This backoff saves battery and avoids hammering a struggling server. 🔋

Quick Check

When should you delete readings from your offline buffer?

Recap

Always save first, upload in batches when online, and clear the buffer only on confirmed success. Your logger now survives any outage. ✅

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

هل درس «تخزين الرفعات وتجميعها» مجاني؟

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

ماذا ستتعلم في «تخزين الرفعات وتجميعها»؟

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

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

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

كم من الوقت يستغرق درس «تخزين الرفعات وتجميعها»؟

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

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

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

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

  1. الحصول على الوقت الحقيقي باستخدام NTP/RTC
  2. كتابة CSV على بطاقة SD
  3. تخزين الرفعات وتجميعها
  4. تصوير البيانات المسجّلة
← العودة إلى Arduino & IoT Academy