رسم النص بأحجام متعددة
اطبع التسميات والقيم بمقاييس مختلفة.
رسم النص بأحجام متعددة درس مجاني في Arduino & IoT Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Arduino & IoT Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Arduino & IoT Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
Text Is Just Pixels
The OLED has no letters built in. The GFX library paints each character as a tiny pattern of pixels, so you control exactly how text looks. ✍️
Pick a Text Color
On a monochrome OLED, color means on or off. Call setTextColor with WHITE so your letters light up against the dark background.
display.setTextColor(WHITE);Set the Text Size
setTextSize(1) draws the base 6x8 pixel font. Larger numbers scale that same shape up, trading sharpness for readability from a distance.
display.setTextSize(1);How Size Scaling Works
Size 2 doubles every pixel, so a letter becomes 12x16. Size is a whole-number multiplier, not a point value, so jumps are chunky but predictable.
Place the Cursor
setCursor(x, y) sets where the next text starts. The top-left corner is (0,0), and x grows right while y grows down the screen.
display.setCursor(0, 0);Print Some Text
Now write words with print or println. They behave like the Serial Monitor, but the output lands on your OLED at the cursor.
display.print("Hello!");Print Numbers Too
You can pass variables straight to print. Mix labels and values to show live data like a temperature reading right on the screen.
display.print("Temp: ");
display.print(temp);A Bold Title
Combine a big title with small details below. Use size 2 for a headline, then drop back to size 1 for the data lines underneath.
display.setTextSize(2);
display.setCursor(0, 0);
display.print("STATUS");Move to a New Line
The cursor does not auto-wrap nicely for layouts. For a clean second line, call setCursor again with a larger y value to drop down.
display.setCursor(0, 20);Always Refresh
Remember the rhythm: clearDisplay, set size and cursor, print, then display. Skip the final display and your fresh text never shows up.
display.clearDisplay();
display.print("Ready");
display.display();Mind the Edges
Big text eats space fast. A size-2 line is 16 pixels tall, so on a 64-pixel screen you fit only a few rows before running off the bottom.
Quick Check
You want letters twice as tall as the default font.
Recap
You set color, chose a text size, positioned the cursor, and printed labels with values. Headlines big, data small, always end with display.
الأسئلة الشائعة
هل درس «رسم النص بأحجام متعددة» مجاني؟
نعم — نص درس «رسم النص بأحجام متعددة» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Arduino & IoT Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Arduino & IoT Academy 4 دروس في المجموع.
ماذا ستتعلم في «رسم النص بأحجام متعددة»؟
اطبع التسميات والقيم بمقاييس مختلفة. تتمرن على Arduino & IoT Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Arduino & IoT Academy؟
لا تُشترط خبرة سابقة. Arduino & IoT Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.
كم من الوقت يستغرق درس «رسم النص بأحجام متعددة»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Arduino & IoT Academy هذا؟
نعم. كل درس في Arduino & IoT Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- توصيل وتهيئة OLED SSD1306
- رسم النص بأحجام متعددة
- الخطوط والمستطيلات والدوائر
- تحريك مخطط أعمدة