0Pricing
Arduino & IoT Academy · レッスン

カーソルを配置して表示する

行と列を指定してテキストを正確に配置します。

「カーソルを配置して表示する」はCoddyKit上の無料Arduino & IoT Academyレッスンです。 これはレッスン3/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これは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. ✅

よくある質問

「カーソルを配置して表示する」レッスンは無料ですか?

はい。「カーソルを配置して表示する」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Arduino & IoT Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Arduino & IoT Academyコースには全4レッスンが含まれています。

「カーソルを配置して表示する」で何を学びますか?

行と列を指定してテキストを正確に配置します。 ブラウザで直接実行するハンズオンコードでArduino & IoT Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

Arduino & IoT Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのArduino & IoT Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン3/4です。

「カーソルを配置して表示する」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このArduino & IoT Academyレッスンでコードを書いて実行できますか?

はい。すべてのArduino & IoT Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. 16x2 LCD(I2Cバックパック)を配線する
  2. LiquidCrystal_I2Cライブラリ
  3. カーソルを配置して表示する
  4. リアルタイムセンサーダッシュボード
← Arduino & IoT Academyに戻る