【arduino实验记录23】OLED显示屏

2020-09-24  本文已影响0人  Geekero

128*64像素的.bmp图像

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <SPI.h>
#include "bitmap.h"
// #include "sensorManage.h"
#define uint8 unsigned char
#define unit16 unsigned int
#define OLED_RESET  8
Adafruit_SSD1306 display(OLED_RESET);

// constant define
#define PICTURE_GLCD_HEIGHT  64
#define PICTURE_GLCD_WIDTH   128
#define BAR_Y 20
#define BAR_X 57
#define BAR_WIDTH 50

//pin define
#define photoPin A0

void setup()
{
  //----by default, we'll generate the high voltage from the 3.3V line internally!(neat!)
  display.begin(SSD1306_SWITCHCAPVCC, 0x3c); //initialize with the the I2C addr 0x3D(for the 128x64)
  display.clearDisplay();
}

void loop()
{
  //showLight();
  showLogo(0, 0);
}

void showLogo(uint8 x, uint8 y)
{
  display.clearDisplay(); //clears the screen and the buffer
  display.drawBitmap(x, y, logo_CLB, PICTURE_GLCD_WIDTH, PICTURE_GLCD_HEIGHT, 1);
  display.display();
}
上一篇 下一篇

猜你喜欢

热点阅读