“TESTPAGE”的版本间的差异

来自YFRobotwiki
跳转至: 导航搜索
第1行: 第1行:
  
<source lang="cpp">
+
<source lang="arduino">
 
/*
 
/*
 
   8-segment display driver of YFRobot 4-bit digital tube module based on TM1650 chip
 
   8-segment display driver of YFRobot 4-bit digital tube module based on TM1650 chip

2020年4月8日 (三) 14:53的版本

无效的语言。

您需要指定一种语言,像这样: <source lang="html4strict">...</source>

语法高亮所支持的语言:

4cs, 6502acme, 6502kickass, 6502tasm, 68000devpac, abap, actionscript, actionscript3, ada, algol68, apache, applescript, apt_sources, arm, asm, asp, asymptote, autoconf, autohotkey, autoit, avisynth, awk, bascomavr, bash, basic4gl, bf, bibtex, blitzbasic, bnf, boo, c, c_loadrunner, c_mac, caddcl, cadlisp, cfdg, cfm, chaiscript, cil, clojure, cmake, cobol, coffeescript, cpp, cpp-qt, csharp, css, cuesheet, d, dcl, dcpu16, dcs, delphi, diff, div, dos, dot, e, ecmascript, eiffel, email, epc, erlang, euphoria, f1, falcon, fo, fortran, freebasic, freeswitch, fsharp, gambas, gdb, genero, genie, gettext, glsl, gml, gnuplot, go, groovy, gwbasic, haskell, haxe, hicest, hq9plus, html4strict, html5, icon, idl, ini, inno, intercal, io, j, java, java5, javascript, jquery, kixtart, klonec, klonecpp, latex, lb, ldif, lisp, llvm, locobasic, logtalk, lolcode, lotusformulas, lotusscript, lscript, lsl2, lua, m68k, magiksf, make, mapbasic, matlab, mirc, mmix, modula2, modula3, mpasm, mxml, mysql, nagios, netrexx, newlisp, nsis, oberon2, objc, objeck, ocaml, ocaml-brief, octave, oobas, oorexx, oracle11, oracle8, oxygene, oz, parasail, parigp, pascal, pcre, per, perl, perl6, pf, php, php-brief, pic16, pike, pixelbender, pli, plsql, postgresql, povray, powerbuilder, powershell, proftpd, progress, prolog, properties, providex, purebasic, pycon, pys60, python, q, qbasic, rails, rebol, reg, rexx, robots, rpmspec, rsplus, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, spark, sparql, sql, stonescript, systemverilog, tcl, teraterm, text, thinbasic, tsql, typoscript, unicon, upc, urbi, uscript, vala, vb, vbnet, vedit, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xbasic, xml, xorg_conf, xpp, yaml, z80, zxbasic


/*
  8-segment display driver of YFRobot 4-bit digital tube module based on TM1650 chip
  Created by yfrobot,Released into the public domain.
*/

#include <YFTM1650.h>

YFTM1650 YF_4BitDis(10, 11);

void setup()
{
  Serial.begin(38400); //Start serial communication at 9600 for debug statements
  Serial.println("YFRobot TM1650 Example Code");
  YF_4BitDis.init();
}

void loop()
{
  YF_4BitDis.setBrightness(1);
  YF_4BitDis.displayString(String("____"));
  delay(1000);
  char line[] = "1234";

  YF_4BitDis.displayString(line);
  YF_4BitDis.setBrightness(7);

  for (int i = 1; i <= 8; i++) {
    YF_4BitDis.setBrightness(i);
    delay(200);
  }
  for (int i = 1; i <= 8; i++) {
    YF_4BitDis.setBrightness(8 - i);
    delay(200);
  }

  YF_4BitDis.displayString(-1.235);
  delay(1000);

  YF_4BitDis.displayString(12.10);
  delay(1000);

  YF_4BitDis.displayString(String("abcd"));
  delay(2000);

  YF_4BitDis.displayString(2020);
  delay(2000);

  if (YF_4BitDis.displayRunning(String("1234567890abcdefghijklmnop"))) {
    delay(500);
    while (YF_4BitDis.displayRunningShift()) {
      delay(500);
    }
  }
  delay(2000);

  for (int i = 0; i < 20; i++) {
    YF_4BitDis.displayOff();
    delay(200);
    YF_4BitDis.displayOn();
    delay(200);
  }

  for (int i = 0; i < 20; i++) {
    YF_4BitDis.setBrightness(1);
    delay(200);
    YF_4BitDis.setBrightness(8);
    delay(200);
  }

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

=== 联系我们

YFROBOT网站:www.yfrobot.com

手机:17696701116(微信/QQ同号)

QQ群【YFROBOT电子技术爱好者】:[243067479](https://jq.qq.com/?_wv=1027&k=51GCh75)

邮件:[finalvalue@yfrobot.com](mailto:finalvalue@yfrobot.com)