ATtiny13 – TM1638 Library

This is tinyAVR (ATtiny13, ATtiny25, ATtiny45, ATtiny85, and other) library for LED controller modules based on TM1638 chip. Modules based on TM1638 provide three signal connections (CLK, STB and DIO) and two power connections (VCC and GND). Signal pins can be connected to any pair of digital pins of the AVR chip. Signal pins configuration is defined at the top of library header file, where it can be modifed.

Key Features

This library has the following features:

  • display digits & dots,
  • display raw segments,
  • display LEDs,
  • display on/off,
  • brightness control,
  • scan keys.

Example Code

This example code demonstrates basic usage of the library:

#include <stdint.h>
#include <util/delay.h>
#include "tm1638.h"

	uint8_t j, i = 0;

	/* setup */
	TM1638_init(1/*enable*/, 7/*brighness*/);

	/* loop */
	while (1) {
		for (j = 0; j < 8; ++j) {
				(i + j) % 0x10/*digit*/,
				!!(i % 0x02)/*dot*/);


Leave a Comment