Hi guys, I am trying to display a number 6 my own way, but I am having trouble displaying the number and there are bugs in my code. I tried to use the display.setSegments() function but it has a bug and I don't know how to display a character. Can anybody help me. Thank you
Always show us a good schematic of your proposed circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.
In the Arduino IDE, use Ctrl T or CMD T to format your code then copy the complete sketch.
Use the </> icon from the ‘reply menu’ to attach the copied sketch.
Okay here's to the code:
#include <Arduino.h>
#include <TM1637Display.h>
int segments[4] = {0, 1, 1, 1};
TM1637Display display(2, 3);
void setup() {
display.setBrightness(7);
}
void loop() {
// Your code here
display.clear();
display.setSegments(segments);
delay(1000);
}
Tell us what this does ?
display.setSegments(segments);
Please use code tags when posting code, and ALWAYS check the library docs. You are not using the function setSegments() correctly.
Please provide a link to the library. Unfortunately, there are several dozen with the same or similar names.
This code sets the segments on the tm1637 display for example:
display.setSegements(0x05, 4, 0) This will set the segments on the tm1637 display
What does this sketch do ?
#include <TM1637Display.h>
byte segments[4] = { 0xff, 0xff, 0xff, 0xff };
// CLK, DIO
TM1637Display display(2, 3);
//********************************************^************************************************
void setup()
{
display.setBrightness(7);
} //END of setup()
//********************************************^************************************************
void loop()
{
display.clear();
display.setSegments(segments);
delay(1000);
} //END of loop()
I figured it out. Thank you everyone
Show us your sketch so others can see what was done.
Here's the sketch:
#include <Arduino.h>
#include <TM1637Display.h>
const uint64_t segments = {
SEG_A | SEG_B | SEG_D | SEG_E | SEG_G,
};
TM1637Display display(2, 3);
void setup() {
display.setBrightness(100);
}
void loop() {
// Your code here
display.clear();
display.setSegments(segments, 4, 0);
delay(10000);
}
Use code tags. See reply #5.
Whats a code tag
Code tags are described in the posting instructions.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.