9720| 11
|
[讨论] [求助]这块显示器怎么用 |
本帖最后由 siska 于 2015-7-25 21:18 编辑 Arduino IIC/I2C 2004 液晶模块 这块显示器是我在以下链接的店里头买的,但是不懂怎么用,求助= =(店主说他不懂。。) https://item.taobao.com/item.htm?spm=a1z09.2.9.19.unhXOO&id=13876958118&_u=p1qoj532ba04 这里是库文件:LiquidCrystal_I2C2004V1.rar |
#include <Wire.h> #include <LiquidCrystal_I2C.h> #if defined(ARDUINO) && ARDUINO >= 100 #define printByte(args) write(args); #else #define printByte(args) print(args,BYTE); #endif LiquidCrystal_I2C lcd(0x20,16,2); // set the LCD address to 0x20 for a 16 chars and 2 line display void setup(){ lcd.init(); // initialize the lcd lcd.backlight(); lcd.home(); lcd.print("Hello world..."); lcd.setCursor(0, 1); lcd.print("dfrobot.com"); } int backlightState = LOW; long previousMillis = 0; long interval = 1000; void loop(){ unsigned long currentMillis = millis(); if(currentMillis - previousMillis > interval) { previousMillis = currentMillis; if (backlightState == LOW) backlightState = HIGH; else backlightState = LOW; if(backlightState == HIGH) lcd.backlight(); else lcd.noBacklight(); } } |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed