จัดตำแหน่งเคอร์เซอร์และพิมพ์ข้อความ
วางข้อความลงในแถวและคอลัมน์ที่ต้องการอย่างแม่นยำ
จัดตำแหน่งเคอร์เซอร์และพิมพ์ข้อความ เป็นบทเรียน Arduino & IoT Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Arduino & IoT Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Arduino & IoT Academy มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
Text Has a Position
Every character lands at a specific spot on the screen. Controlling the cursor lets you place text exactly where you want it. 🎯
Columns Count from Zero
The 16 columns are numbered 0 to 15, left to right. Column 0 is the first character on a line.
Rows Count from Zero Too
The two rows are 0 and 1. Row 0 is the top line and row 1 is the bottom line.
Move the Cursor
Use setCursor to jump to a column and row before printing. The arguments are column first, then row.
lcd.setCursor(0, 1);Print at That Spot
After setCursor, the next lcd.print() starts exactly where you placed the cursor instead of the top-left.
lcd.setCursor(0, 1);
lcd.print("Line two");Two Lines at Once
Print a label on row 0, move the cursor to row 1, then print a value. That gives you a tidy two-line layout.
Center Some Text
To center a word, set the cursor to a higher column so the text starts further from the left edge.
lcd.setCursor(5, 0);Printing Numbers
lcd.print also accepts numbers, not just text. Pass a variable and the value shows up directly on screen.
lcd.print(temperature);Watch Leftover Characters
Old text does not vanish on its own. If a new value is shorter, stray old digits can linger behind it.
Pad to Overwrite
Print extra spaces after a short value, or clear that area, so the previous longer text is fully covered.
lcd.print(value);
lcd.print(" ");Home Position
Calling lcd.home() sends the cursor back to column 0, row 0 without clearing the existing text.
lcd.home();Quick Check
You want text to appear on the bottom-left of a 16x2 LCD. Which call positions the cursor there?
Recap
You can now place text anywhere with setCursor, remembering column then row from zero, and pad with spaces to clear old characters. ✅
คำถามที่พบบ่อย
บทเรียน “จัดตำแหน่งเคอร์เซอร์และพิมพ์ข้อความ” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “จัดตำแหน่งเคอร์เซอร์และพิมพ์ข้อความ” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ 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 ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน
บทเรียน “จัดตำแหน่งเคอร์เซอร์และพิมพ์ข้อความ” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Arduino & IoT Academy นี้ได้ไหม
ได้ บทเรียน Arduino & IoT Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- ต่อสาย LCD ขนาด 16x2 (แผงต่อ I2C)
- ไลบรารี LiquidCrystal_I2C
- จัดตำแหน่งเคอร์เซอร์และพิมพ์ข้อความ
- แดชบอร์ดเซนเซอร์แบบสด