====== IsegWrite() ====== ''IsegWrite()'' outputs segment data at the specified position. {{:en-us_commands:reference:isegwrite.svg?900|IsegWrite command operation flow}} ''bool IsegWrite(const uint8_t segments[], uint8_t length = 4, uint8_t position = 0, uint8_t device = 0)'' ===== Commands ===== ^ Command ^ Arguments ^ Return Value ^ Operation ^ | ''IsegWrite(segments, length, position, device)'' | ''const uint8_t segments[]'' — Array of ''XGFEDCBA'' segment bits for each digit\\ ''uint8_t length = 4'' — Number of digits to write ''1~4''\\ ''uint8_t position = 0'' — Start position ''0~3''; the leftmost digit is ''0''\\ ''uint8_t device = 0'' — FND device number ''0~6'', defaults to ''0'' | ''bool'' | Outputs segment data at the specified position. | ===== 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 ===== * These commands are only for 4-digit FND displays with a TM1637 IC. They do not directly drive a generic multiplexed FND display. * Use display commands after successfully calling ''IsegBegin()''. * Initialization fails if CLK and DIO use the same pin, or if the device number is ''7'' or higher. * ''length + position'' must be 4 or less. Numbers outside the range are not displayed, and ''false'' is returned. * Communication may block execution for several ms. Do not call this from an interrupt service routine. * Do not use the specified pins simultaneously for UART, PWM, encoders, external interrupts or other functions. * Check the actual module and product manuals for FND power and signal voltages. ===== Built-in Commands in the Same Category ===== * [[:en-us_commands:reference:isegbegin|IsegBegin() View detailed description]] * [[:en-us_commands:reference:isegbrightness|IsegBrightness() View detailed description]] * [[:en-us_commands:reference:isegclear|IsegClear() View detailed description]] * [[:en-us_commands:reference:isegdecimal|IsegDecimal() View detailed description]] * [[:en-us_commands:reference:iseghex|IsegHex() View detailed description]] * [[:en-us_commands:reference:isegencodedigit|IsegEncodeDigit() View detailed description]] [[:en-us_commands:builtin|← Built-in Command List]]