0Pricing
Arduino & IoT Academy · บทเรียน

วาดข้อความหลายขนาด

แสดงป้ายกำกับและค่าด้วยขนาดต่าง ๆ

วาดข้อความหลายขนาด เป็นบทเรียน Arduino & IoT Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 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.

คำถามที่พบบ่อย

บทเรียน “วาดข้อความหลายขนาด” ฟรีหรือไม่

ใช่ — ข้อความเต็มของ “วาดข้อความหลายขนาด” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Arduino & IoT Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Arduino & IoT Academy มีบทเรียนทั้งหมด 4 บทเรียน

คุณจะเรียนรู้อะไรในบทเรียน “วาดข้อความหลายขนาด”

แสดงป้ายกำกับและค่าด้วยขนาดต่าง ๆ คุณปฏิบัติ Arduino & IoT Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน

คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Arduino & IoT Academy หรือไม่

ไม่จำเป็นต้องมีประสบการณ์มาก่อน Arduino & IoT Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน

บทเรียน “วาดข้อความหลายขนาด” ใช้เวลานานแค่ไหน

บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย

ฉันเขียนและรันโค้ดในบทเรียน Arduino & IoT Academy นี้ได้ไหม

ได้ บทเรียน Arduino & IoT Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ

บทเรียนทั้งหมดในหลักสูตรนี้

  1. ต่อสายและเริ่มต้น SSD1306 OLED
  2. วาดข้อความหลายขนาด
  3. เส้น สี่เหลี่ยม และวงกลม
  4. สร้างภาพเคลื่อนไหวให้กราฟแท่ง
← กลับไปที่ Arduino & IoT Academy