ESP8266用Arduino如何驱动OLED12864

我们在Arduino IED中首先打开库管理工具,然后搜索ACROBOTIC,然后安装这个库,如图所示:
在这里插入图片描述
打开示例后一共有四个实例,这里我粘贴一段代码。大家看一下:

#include <Wire.h>
#include <ACROBOTIC_SSD1306.h>

void setup()
{
  Wire.begin();	
  oled.init();                      // Initialze SSD1306 OLED display
  oled.clearDisplay();              // Clear screen
  oled.setTextXY(0,0);              // Set cursor position, start of line 0
  oled.putString("ACROBOTIC");
  oled.setTextXY(1,0);              // Set cursor position, start of line 1
  oled.putString("industries");
  oled.setTextXY(2,0);              // Set cursor position, start of line 2
  oled.putString("Pasadena,");
  oled.setTextXY(2,10);             // Set cursor position, line 2 10th character
  oled.putString("CA");
}

void loop()
{
}

我觉得他的代码是很精炼的。接线方式如图,你也可以访问ACROBOTIC的官网
在这里插入图片描述
下载后的效果为:
在这里插入图片描述
另一个实例为画一个标志(logo):
在这里插入图片描述
但是这个库也是有缺点的,没有提供画多边形的例子。
希望对大家有所帮助。

猜你喜欢

转载自blog.csdn.net/Cloud_1234_5678/article/details/84315894