Table of Contents

IsegEncodeDigit()

IsegEncodeDigit() converts one digit to segment data.

IsegEncodeDigit command operation flow

uint8_t IsegEncodeDigit(uint8_t digit)

Commands

Command Arguments Return Value Operation
IsegEncodeDigit(digit) uint8_t digit uint8_t Converts one digit to segment data.

Example

const uint8_t CLK_PIN = 14;
const uint8_t DIO_PIN = 15;
 
void setup() {
  IsegBegin(CLK_PIN, DIO_PIN, 100, 0);  // Set the CLK/DIO pins and device number of the TM1637 FND.
  IsegBrightness(5, true, 0);  // Set display brightness and on/off state.
}
 
void loop() {
  const uint16_t value = analogRead(A0);  // Read the raw analog value of the specified channel.
  uint8_t digits[4] = {
    IsegEncodeDigit((value / 1000) % 10),  // Convert one digit to segment data.
    IsegEncodeDigit((value / 100) % 10),  // Convert one digit to segment data.
    IsegEncodeDigit((value / 10) % 10),  // Convert one digit to segment data.
    IsegEncodeDigit(value % 10)  // Convert one digit to segment data.
  };
  IsegWrite(digits, 4, 0, 0);  // Output segment data at the specified position.
  delay(100);
}

Precautions

Built-in Commands in the Same Category

← Built-in Command List