User Tools

Site Tools


en-us_commands:reference:iclcdtextdirection

This is an old revision of the document!


IclcdTextDirection()

IclcdTextDirection() sets the text entry direction.

IclcdTextDirection command operation flow

bool IclcdTextDirection(bool leftToRight = true, uint8_t device = 0)

Commands

Command Arguments Return Value Operation
IclcdTextDirection(leftToRight, device) bool leftToRight = true
uint8_t device = 0
bool Sets the text entry direction.

Example

const uint8_t LCD_DEVICE = 0;
const uint8_t degreeChar[8] = {0x0C, 0x12, 0x12, 0x0C, 0, 0, 0, 0};
 
void setup() {
  if (!IclcdBegin(0x27, 20, 4, true, LCD_DEVICE)) return;  // Set the address and dimensions of the PCF8574 character LCD.
  IclcdCreateChar(0, degreeChar, LCD_DEVICE);  // Register a custom character.
  IclcdClear(LCD_DEVICE);  // Clear the LCD screen.
  IclcdHome(LCD_DEVICE);  // Move the cursor to the first position.
  IclcdDisplay(true, LCD_DEVICE);  // Turn the LCD display on or off.
  IclcdCursor(false, LCD_DEVICE);  // Show or hide the cursor.
  IclcdBlink(false, LCD_DEVICE);  // Enable or disable cursor blinking.
  IclcdBacklight(true, LCD_DEVICE);  // Turn the LCD backlight on or off.
  IclcdTextDirection(true, LCD_DEVICE);  // Set the direction in which characters are entered.
  IclcdAutoscroll(false, LCD_DEVICE);  // Enable or disable autoscroll.
}
 
void loop() {
  const float temperature = ntcReadf(0);  // Return the NTC 3950 10kΩ sensor temperature as a floating-point value in °C.
  IclcdSetCursor(0, 0, LCD_DEVICE);  // Move the cursor to the specified column and row.
  IclcdPrint(F("Temperature"), LCD_DEVICE);  // Print a string or number to the LCD.
  IclcdSetCursor(0, 1, LCD_DEVICE);  // Move the cursor to the specified column and row.
  IclcdPrint(temperature, 1, LCD_DEVICE);  // Print a string or number to the LCD.
  IclcdWrite(0, LCD_DEVICE);  // Output a character code or custom character.
  IclcdPrint('C', LCD_DEVICE);  // Print a string or number to the LCD.
 
  if (Iup(0, IdigitalRead(0, 5))) IclcdScrollLeft(LCD_DEVICE);  // Shift the displayed content one position left. / Read the input repeatedly and update only if all samples match. If HIGH and LOW are mixed, retain the previous stable state. / Return true only at the instant the input changes from OFF to ON.
  if (Iup(1, IdigitalRead(1, 5))) IclcdScrollRight(LCD_DEVICE);  // Shift the displayed content one position right. / Read the input repeatedly and update only if all samples match. If HIGH and LOW are mixed, retain the previous stable state. / Return true only at the instant the input changes from OFF to ON.
  if (Iup(2, IdigitalRead(2, 5))) IclcdCommand(0x02, LCD_DEVICE);  // Read the input repeatedly and update only if all samples match. If HIGH and LOW are mixed, retain the previous stable state. / Send an LCD control command directly. / Return true only at the instant the input changes from OFF to ON.
}

Precautions

  • PCF8574 connections use the same mapping as the existing CLCD library: P0=RS, P1=R/W, P2=Enable, P3=backlight, P4~P7=LCD D4~D7.
  • Verify the LCD module's actual I²C address using its settings and I²C scan results.
  • SDA/SCL can share the bus with other I²C devices, but addresses must not overlap.
  • Do not run Wire transfers or I²C slave callbacks concurrently with Iclcd…(). Iclcd transfers run at 100 kHz and then restore the previous TWI settings.
  • On MPAINO, using D20/D21 for external interrupts prevents simultaneous I²C use.
  • IclcdCommand() can change the LCD state directly. Use it only if you understand HD44780 commands.

← Built-in Command List

en-us_commands/reference/iclcdtextdirection.1788791733.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki