// Create code Programming C++ Setup control Arduino UNO R3
// TM1637 config 7segment
#include <TM1637.h>
TM1637 TM1;
char buffer[5]; // buffer for third display
void setup() {
Serial.begin(9600);
Serial.println("Type your text for the display.");
Serial.println("Now displaying \"----\".");
TM1.begin(4, 5, 4); // clockpin, datapin, #digits
TM1.displayClear();
TM1.setBrightness(7); // full brightness, default is 3
TM1.displayPChar("----"); // Initial text on third display
}
void loop() {
if (Serial.available() > 0)
{
int inChar = Serial.read();
if (isprint(inChar))
{
for( int i=0; i<3; i++) // shift buffer to the left
buffer[i] = buffer[i+1];
buffer[3] = (char) inChar; // add new character
buffer[4] = '\0'; // add zero-terminator
}
TM1.displayPChar(buffer); // display the new text
}
}