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

Download:

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

 

Description:

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

 

Components:

Board: ESP32 nodeMCU DevBoard/DevKit

LED and Key: LED & KEY TM1638 Module

Arduino IDE, Arduino

 

 

https://amzn.to/2wOkFBK    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

G4->STB

G16->CLK

G17->DIO

GND->GND

3V3->VSS

 

 

 

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_TYPE CLOCK_INVERT

#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

  reset();

}

 

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

TM1638-demos-and-examples

https://github.com/MartyMacGyver/TM1638-demos-and-examples/blob/master/arduino/TM1638_buttons/TM1638_buttons.ino

 

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:

 

https://amzn.to/3cfCZCA       3 Stück von AZDelivery 3 x ESP32 NodeMCU Module WLAN WiFi Development Board mit CP2102 (Nachfolgermodell zum ESP8266)  24,99 Euro

https://amzn.to/2wGkyYR     1x Stück: AZDelivery ESP32 NodeMCU Module WLAN WiFi Development Board mit CP2102 für 9,79 Euro

https://amzn.to/2KaC1eQ     AZDelivery HD44780 2004 LCD Display grün Bundle 4x20 Zeichen mit I2C Schnittstelle für Arduino

https://amzn.to/2wKzzJc       AZDelivery HD44780 2004 LCD Display Bundle 4x20 Zeichen mit I2C Schnittstelle für Arduino

 

Mobile
»
ESP32 Code: Create an output pulse with adjustable pulse width via button and display on LCD and digits
»
8 Charater LED anzeigen an einer ESP32 mit TM1638 Led Buttons
»
ESP32 NodeMCU mit TM1838 Buttons
»
Arduino Code: Create variable pulses with ESP32 DevKit
»
Arduino: view float with 2 commas
»
Connect an LCD display on ESP32

.

Contact for Jobs, Project Requests: raimund.popp@microsoft-programmierer.de