阿正的网易云音乐 - 创建于 2017

一个大学生的学习心得,与君共勉。

i2c总线的oled12864屏的u8x8运用总结

github网址链接

https://github.com/olikraus/u8g2/wiki/u8x8reference#print

用到的库文件

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>

引脚定义

U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE); // OLEDs without Reset of the Display

屏幕初始化

u8x8.begin();
u8x8.setPowerSave(0);

 

字体设置

 u8x8.setFont(u8x8_font_amstrad_cpc_extended_r);

字体列表在github网站可查:https://github.com/olikraus/u8g2/wiki/fntlist8x8

字体的显示有两种 

一是用drawstring显示,例如

u8x8.draw2x2String(3, 3, "Fisher");

这种直接设置了它的显示坐标。

二使用print输出

u8x8.setCursor(15,2);//这里设置显示的坐标
u8x8.print("m");//输出显示内容

同时这种可以输出传感器数据。

在GitHub网站里有很多资料的。有待学习!

 

posted @ 2018-01-25 13:50  阿♛正  阅读(2396)  评论(0编辑  收藏  举报