WeMOS: TM1650 7 Segmen Display

From OnnoWiki
Revision as of 05:42, 9 November 2019 by Onnowpurbo (talk | contribs) (Created page with "==Untuk TM16560== http://downloads.arduino.cc/libraries/github.com/arkhipenko/TM1650-1.1.0.zip mv TM1650-1.1.0.zip ~/Arduino/libraries/ cd ~/Arduino/libraries unzip TM16...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Untuk TM16560

http://downloads.arduino.cc/libraries/github.com/arkhipenko/TM1650-1.1.0.zip
mv TM1650-1.1.0.zip ~/Arduino/libraries/
cd ~/Arduino/libraries
unzip TM1650-1.1.0.zip

Code

#include <Wire.h>
#include <TM1650.h>

TM1650 d;

void setup() 
{
  Wire.begin(); //Join the bus as master

  Serial.begin(115200); //Start serial communication at 9600 for debug statements
  Serial.println("TM1650 Example Code");

  d.init();
}

void loop() 
{
  d.displayOff();
  d.displayString("____");
  d.setBrightness(TM1650_MIN_BRIGHT);
  d.displayOn();
  delay(100);
  char line[] = "1234"; 

  d.displayString(line);
  d.setBrightnessGradually(TM1650_MAX_BRIGHT);
  delay(2000);
  d.setBrightnessGradually(TM1650_MIN_BRIGHT);
  d.displayOff();
  delay(1000);
  
  line[1] |= 128;
  d.displayOn();
  d.setBrightnessGradually(TM1650_MAX_BRIGHT);
  d.displayString(line);
  delay(2000);
   
//  for (int i=0; i<8; i++) {
//    d.setBrightness(i);
//    delay(500);
//  }
  
  d.displayString("abcd");
  delay(2000); 

  d.displayString("789 ");
  delay(2000);
  
  if (d.displayRunning("1234567890abcdefghijklmnop")) {
    while (d.displayRunningShift()) delay(500);
  }
  delay(2000);
  
  for (int i = 0; i<20; i++) {
    d.displayOff();
    delay(200);
    d.displayOn();
    delay(200);
  }
  
  for (int i = 0; i<20; i++) {
    d.setBrightness(1);
    delay(200);
    d.setBrightness(7);
    delay(200);
  } 

  for (int i = 0; i<20; i++) {
    for (int j = 0; j<4; j++) {
       d.setDot(j,true);
       delay(200);
    }
    for (int j = 0; j<4; j++) {
       d.setDot(j,false);
       delay(200);
    }
  } 
}




Pranala Menarik