zoukankan      html  css  js  c++  java
  • 微雪2.9寸墨水屏

    树莓派与2.9寸墨水屏

    效果

    result_image

    所需

    • 树莓派3B
    • 微雪2.9寸墨水屏(黑白)
    • GPIO跳线

    试试用2.9寸的墨水屏显示图片或二维码,测试局刷与全刷。

    连接

    墨水屏模块 树莓派
    BCM2835 Board
    VCC 3.3V 3.3V
    GND GND GND
    DIN MOSI 19
    CLK SCLK 23
    CS CE0 24
    DC 25 22
    RST 17 11
    BUSY 24 18

    开启SPI

    在命令行中输入sudo raspi-config选择Interfacing Options -> SPI -> enable

    拉取github代码

    sudo git clone https://github.com/waveshare/e-Paper
    cd e-Paper/RaspberryPi&JetsonNano/
    cd python/examples
    sudo python3 epd_2in9_test.py
    

    检查墨水屏是否正常工作
    test

    显示一张二维码

    1 图片的尺寸必须为296x128
    2 图片的模式必须为'1',(黑白1位像素,每字节存储一个像素)

    代码部分

    修改try语句中的代码

    try:
        epd = epd2in9.EPD()
        logging.info("全刷新")
        epd.init(epd.lut_full_update)
        epd.Clear(0xFF)
        font24 = ImageFont.truetype(os.path.join(picdir, 'Font.ttc'), 13)
        logging.info("Me")
        Himage=Image.open('result_image.png')
        Himage=Himage.convert('1')
        epd.display(epd.getbuffer(Himage))
        time.sleep(5)
        logging.info('QrCode')
        epd.init(epd.lut_full_update)
        epd.Clear(0xFF)
        Himage=Image.open('qrcode.png')
        epd.display(epd.getbuffer(Himage))
        time.sleep(5)
        logging.info('休眠')
        epd.sleep()
    except IOError as e:
        logging.info(e)
    
    except KeyboardInterrupt:
        logging.info("ctrl + c:")
        epd2in9.epdconfig.module_exit()
        exit()
    
  • 相关阅读:
    Zabbix的前台SQL注射漏洞利用
    LeetCode OJ--Permutation Sequence *
    LeetCode OJ--Next Permutation *
    LeetCode OJ--Permutations II
    LeetCode OJ--Permutations *
    小算法-计算下一个排列
    LeetCode OJ--Gas Station**
    LeetCode OJ--Insert Interval **
    LeetCode OJ--Search Insert Position
    Ruby自动化测试(操作符的坑)
  • 原文地址:https://www.cnblogs.com/1328497946TS/p/12511470.html
Copyright © 2011-2022 走看看