【Arduino】1.4 I2C LCD1602屏幕的使用
2016-08-03 14:12
726 查看
//Code1 #include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x3F,16,2); // set the LCD address to 0x27 for a 16 chars and 2 line display void setup(){ lcd.init(); // initialize the lcd lcd.backlight(); //Open the backlight lcd.print("Welcome to "); // Print a message to the LCD. lcd.setCursor(0,1); //newline lcd.print("www.CSDN.com");// Print a message to the LCD } void loop(){ }
//Find Address #include <Wire.h> void setup(){ Wire.begin(); Serial.begin(9600); Serial.println("\nI2C Scanner"); } void loop(){ byte error, address; int nDevices; Serial.println("Scanning..."); nDevices = 0; for (address = 1; address < 127; address++ ){ // The i2c_scanner uses the return value of // the Write.endTransmisstion to see if // a device did acknowledge to the address. Wire.beginTransmission(address); error = Wire.endTransmission(); if (error == 0){ Serial.print("I2C device found at address 0x"); if (address < 16) Serial.print("0"); Serial.print(address, HEX); Serial.println(" !"); nDevices++; }else if (error == 4){ Serial.print("Unknow error at address 0x"); if (address < 16) Serial.print("0"); Serial.println(address, HEX); } } if (nDevices == 0) Serial.println("No I2C devices found\n"); else Serial.println("done\n"); delay(5000); // wait 5 seconds for next scan }
开发中遇到的问题
1、屏幕无显示
调节后面的对比度,查看2、一行黑点
地址错误,使用代码二查看地址,然后修改代码一。3、如何连接跳线
GND-GNDVCC-5V
SDA-A4
SCL-A5
相关文章推荐
- Arduino 和LCD1602液晶屏 I2C接口实验
- Arduino使用时钟模块(Tiny RTC i2C)
- 【Arduino】使用LCD1602和DHT11制作温湿度显示器
- P-1.4 学习使用PIL在屏幕中寻找颜色
- Arduino使用LCD1602
- 【Arduino】使用LCD1602和DHT11制作温湿度显示器
- 屏幕颜色的设置和清屏函数的使用
- Prototype.js 1.4中文使用手册PDF版下载
- 用Retroweaver 在JDK1.4上使用JDK5.0的特征
- 使用'VRM_SET_VALUES'函数在selection屏幕上建一个Combobox控件示例
- 使用'SAPGUI_SET_PROPERTY'函数是GUI屏幕可见和不可见
- Java的秘密武器:使用全屏幕模式
- 使用'VRM_SET_VALUES'函数在selection屏幕上建一个Combobox控件示例
- 使用 ClearType 获得更佳的屏幕分辨率
- 在应用程序中使用启动屏幕和登陆窗口
- 使用'VRM_SET_VALUES'函数在selection屏幕上建一个Combobox控件示例
- JDK1.4的java.util.Logging包的使用说明与示例
- Java的秘密武器:使用全屏幕模式
- 使用 ClearType 获得更佳的屏幕分辨率
- java-Java的秘密:使用全屏幕模式