Freelance Project Requests Software Development in C# WPF Asp.Net Core Vba Excel Word SQL-Server EF Linq, UWP Net


Datei 1: wiring_shift_mod.cpp
Datei 2: wiring_shift_mod.h
Datei 3: esp32_TM1638_LEDs.ino
Datei 4: wiring_shift_mod.cpp
Datei 5: wiring_shift_mod.h
Datei 6: esp32_TM1638_LEDs.ino

8 Charater LED display on an ESP32 with TM1638 Led&Buttons



The following code brings the first and last LED of a TM1638 LED&KEY display to the leuchen

The Arduino/ESP32 code serves as a code example for operating the LED board on an ESP32


Example application:

Operating a button board / module on an ESP32 nodeMCU board



Board: ESP32 nodeMCU DevBoard/DevKit

LED and Key: LED & KEY TM1638 Module

Arduino IDE, Arduino    8-bit LED + 8-bit digital tube +8- Bit Key TM1638 module + cable (5.72 Euro)



According to the instructions of the TM1638 and ESP32 nodeMCU

Connection PINS ESP32 -> TM1638









Arduino IDE Code

Simply enter this code into the Arduino IDE, compile the code and paste it to the ESP32 nodeMCU


#include "wiring_shift_mod.h"



#define CLOCK_DELAY_US 1


const int strobe_pin =  4;

const int clock_pin  = 16;

const int data_pin   = 17;


void setup()


  pinMode(strobe_pin, OUTPUT);

  pinMode(clock_pin, OUTPUT);

  pinMode(data_pin, OUTPUT);


  sendCommand(0x8f);  // activate




void loop()


  sendCommand(0x44);  // set single address


  digitalWrite(strobe_pin, LOW);

  shiftOutMod(data_pin, clock_pin, LSBFIRST, CLOCK_TYPE, CLOCK_DELAY_US, 0xc0); // 1st digit

  shiftOutMod(data_pin, clock_pin, LSBFIRST, CLOCK_TYPE, CLOCK_DELAY_US, 0xff);

  digitalWrite(strobe_pin, HIGH);


  digitalWrite(strobe_pin, LOW);

  shiftOutMod(data_pin, clock_pin, LSBFIRST, CLOCK_TYPE, CLOCK_DELAY_US, 0xc5); // 3rd LED

  shiftOutMod(data_pin, clock_pin, LSBFIRST, CLOCK_TYPE, CLOCK_DELAY_US, 0x01);

  digitalWrite(strobe_pin, HIGH);


  digitalWrite(strobe_pin, LOW);

  shiftOutMod(data_pin, clock_pin, LSBFIRST, CLOCK_TYPE, CLOCK_DELAY_US, 0xcb); // 3rd LED

  shiftOutMod(data_pin, clock_pin, LSBFIRST, CLOCK_TYPE, CLOCK_DELAY_US, 0x01);

  digitalWrite(strobe_pin, HIGH);


  digitalWrite(strobe_pin, LOW);

  shiftOutMod(data_pin, clock_pin, LSBFIRST, CLOCK_TYPE, CLOCK_DELAY_US, 0xce); // last digit

  shiftOutMod(data_pin, clock_pin, LSBFIRST, CLOCK_TYPE, CLOCK_DELAY_US, 0xff);

  digitalWrite(strobe_pin, HIGH);



void sendCommand(uint8_t value)


  digitalWrite(strobe_pin, LOW);

  shiftOutMod(data_pin, clock_pin, LSBFIRST, CLOCK_TYPE, CLOCK_DELAY_US, value);

  digitalWrite(strobe_pin, HIGH);



void reset()


  sendCommand(0x40); // set auto increment mode

  digitalWrite(strobe_pin, LOW);

  shiftOutMod(data_pin, clock_pin, LSBFIRST, CLOCK_TYPE, CLOCK_DELAY_US, 0xc0);   // set starting address to 0

  for(uint8_t i = 0; i < 16; i++)


    shiftOutMod(data_pin, clock_pin, LSBFIRST, CLOCK_TYPE, CLOCK_DELAY_US, 0x00);


  digitalWrite(strobe_pin, HIGH);



Link to GitHub MartyMacGyver



Arduino IDE



Expanding the Arduino Library


In order for the line to be

#include "wiring_shift_mod.h"

You have to expand the Arduino Libraries. for this you can go to Arduino IDE program ->Menu->File->Preferences

And opens the path to Sketchbook location


Expand Arduino Library


The library files are attached

Wiring_shift_mod.cpp and wiring_shift_mod.h

In the directory %Documents%"Arduino-libraries


Bezugsquellen:       3 Stück von AZDelivery 3 x ESP32 NodeMCU Module WLAN WiFi Development Board mit CP2102 (Nachfolgermodell zum ESP8266)  24,99 Euro     1x Stück: AZDelivery ESP32 NodeMCU Module WLAN WiFi Development Board mit CP2102 für 9,79 Euro     AZDelivery HD44780 2004 LCD Display grün Bundle 4x20 Zeichen mit I2C Schnittstelle für Arduino       AZDelivery HD44780 2004 LCD Display Bundle 4x20 Zeichen mit I2C Schnittstelle für Arduino




Contact for Jobs, Project Requests: