0

I'm having trouble getting my NodeMCU connected to 4 x 4 Digit 7 Segment Displays.

So far I've been able to connect 2 & get them to display things from the demo repository.

However, after trying all possible combinations of different pins & looking up the pinout reference I have no idea why I can't get them to work.

Any help would be greatly appreciated.

I'm working with:

  • ESP8266 NodeMCU ESP-12E (CP2102)

  • 4 Digit 7 Segment Display (TM1637)

As suggested @romkey:

#include <Arduino.h>
#include <TM1637Display.h>

// Module connection pins (Digital Pins)

#define CLK_1 D2
#define DIO_1 D3

#define CLK_2 D5
#define DIO_2 D6

#define CLK_3 13
#define DIO_3 15

// The amount of time (in milliseconds) between tests
#define TEST_DELAY   500

TM1637Display display1(CLK_1, DIO_1);
TM1637Display display2(CLK_2, DIO_2);
TM1637Display display3(CLK_3, DIO_3);

void setup()
{
}

void loop()
{
  int k;
  uint8_t data[] = { 0xff, 0xff, 0xff, 0xff };
  uint8_t blank[] = { 0x00, 0x00, 0x00, 0x00 };
  display1.setBrightness(0x0f);
  display2.setBrightness(0x0f);
  display3.setBrightness(0x0f);
 
  // Brightness Test
  for(k = 0; k < 4; k++)
    data[k] = 0xff;
  for(k = 0; k < 7; k++) {
    display1.setBrightness(k);
    display1.setSegments(data);
    display2.setBrightness(k);
    display2.setSegments(data);
    display3.setBrightness(k);
    display3.setSegments(data);
    delay(TEST_DELAY);
  }
  while(1);
}

I've tried addressing the CLK_3 & DIO_3 pins as "Dx" but that didn't work as well.

Repos used:

3
  • 2
    There’s a lot that can go wrong here. If you share exactly how you connected the most likely to work circuit and a minimal viable example of the code that doesn’t work, someone will be more likely to help you. – romkey Apr 7 at 18:35
  • use one clock pin for all. avoid boot config pins D3,D4,D8 and RTC pin D0 – Juraj Apr 7 at 19:03
  • Try one display at a time but on different pins to make sure that your selection works at all. Only after success merge all together. – the busybee Apr 8 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.