Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- To control a TM1637 4x7 segment LED display with a colon separator and size 30x14mm (0.35") using an Arduino, you can follow the steps below:
- Install the TM1637 library. You can download it from the Arduino Library Manager, or from the following GitHub repository: https://github.com/avishorp/TM1637. Follow the instructions on the repository to install the library.
- Connect the TM1637 display to the Arduino:
- VCC pin to the 5V pin on the Arduino
- GND pin to the GND pin on the Arduino
- DIO (Data) pin to a digital pin on the Arduino (e.g., pin 2)
- CLK (Clock) pin to another digital pin on the Arduino (e.g., pin 3)
- Upload the following code to your Arduino board:
- This example code will display the number 1234 on the TM1637 display with the colon separator enabled. You can change the number variable to display a different number or implement your own logic to update the displayed number.
- */
- #include <Arduino.h>
- #include <TM1637Display.h>
- // Pin connections for the TM1637 display
- const int CLK = 2;
- const int DIO = 3;
- // Create a TM1637 display object
- TM1637Display display(CLK, DIO);
- // Example number to display
- int number = 1234;
- void setup() {
- // Set the display's brightness (0 to 7)
- display.setBrightness(7);
- }
- void loop() {
- // Display the number
- display.showNumberDec(number, true); // The second parameter "true" enables the colon separator
- // Wait for a while
- delay(1000);
- // You can add your own logic here to update the displayed number or implement other functionality
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement