美文网首页
【arduino实验记录23】OLED显示屏

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

作者: Geekero | 来源:发表于2020-09-24 12:37 被阅读0次

    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();
    }
    

    相关文章

      网友评论

          本文标题:【arduino实验记录23】OLED显示屏

          本文链接:https://www.haomeiwen.com/subject/imxvyktx.html