这个例程显示了如何在OCROBOT ALPHA 1602 LCD显示屏上显示A到Z。
const int numRows = 2; const int numCols = 16; #include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x20,numCols,numRows); void setup() { lcd.init(); lcd.backlight(); } void loop() { // 'a' 到 'z'循环: for (int thisLetter = 'a'; thisLetter <= 'z'; thisLetter++) { // 行循环: for (int thisRow = 0; thisRow < numRows; thisRow++) { // 列循环: for (int thisCol = 0; thisCol < numCols; thisCol++) { // 设置光标位置: lcd.setCursor(thisCol, thisRow); // 显示字符: lcd.write(thisLetter); delay(200); } } } }