#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x3F,16,2);
//显示字符
#if defined(ARDUINO) && ARDUINO >= 100
#define printByte(args) write(args);
#else
#define printByte(args) print(args,BYTE);
#endif
//要显示的汉字编码,定义为一个数组
uint8_t dian[8]= {0x04,0x1F,0x15,0x1F,0x15,0x1F,0x04,0x07,};//电
uint8_t ya[8]= {0x0F,0x08,0x0A,0x0F,0x0A,0x0B,0x0A,0x17,};//压
uint8_t fu[8]={ 0x10,0x1C,0x14,0x04,0x1F,0x15,0x0A,0x11,};//负
uint8_t bat[8]={ 0x0E,0x1F,0x11,0x1F,0x1F,0x1F,0x1F,0x1F,};//
void setup(){
lcd.init(); //初始化LCD
lcd.backlight(); //打开背光
//创建新字符,将每个数组映射为一个字符,分别命名为0,1,2,3,4
lcd.createChar(0, bat);
//将字符显示到光标所在位
lcd.setCursor(0,0);
lcd.printByte(0);
lcd.setCursor(1,0);
lcd.print("13.8V");
}
void loop() {
// put your main code here, to run repeatedly:
}
//--------------------------------------------
电池
uint8_t bat[8]={ 0x0E,0x1F,0x11,0x1F,0x1F,0x1F,0x1F,0x1F,};//
闪电
uint8_t A[8]= { 0x00,0x02,0x04,0x08,0x1F,0x02,0x04,0x08,}
太阳能板
uint8_t solar[8]= { 0x1F,0x15,0x1F,0x15,0x1F,0x15,0x1F,0x00,};