Giter VIP home page Giter VIP logo

lumademo's Introduction

lumaDemo

一个简单的lumaDemo,在一个通过I2C连接到树莓派的OLED屏上输出几个字符。

luma安装

luma.examples
安装依赖包

$ sudo usermod -a -G i2c,spi,gpio pi
$ sudo apt install python3-dev python3-pip python3-numpy libfreetype6-dev libjpeg-dev build-essential
$ sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libportmidi-dev

然后下载luma.examples文件夹

$ git clone https://github.com/rm-hull/luma.examples.git

进入文件夹安装luma组件

$ cd luma.examples
$ sudo -H pip install -e .

luma部署到Docker

基于balenalib/rpi-raspbian镜像

Dockerfile:

FROM balenalib/rpi-raspbian:latest
ENTRYPOINT []

RUN apt-get -q update
RUN apt-get -q upgrade
RUN apt install python3-dev python3-pip python3-numpy libfreetype6-dev libjpeg->
RUN apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev>
RUN pip install rpi.gpio

RUN git clone https://github.com/rm-hull/luma.examples.git
RUN cd luma.examples && pip install -e .

CMD ["python3","luma.examples/examples/3d_box.py"]

注: 运行镜像时需要添加--privileged,否则无法访问GPIO

生成镜像并运行后会执行自带的3d_box.py

可自行修改Dockerfile文件嵌入自己的python程序,或者把这个作为基础镜像再生成新的镜像

oled屏幕的I2C连接

树莓派                                               OLED
PIN 1(3V3)           --------------->           VCC
PIN 3(SDA.1)       --------------->           SDA
PIN 5(SCL.1)        --------------->           SCL
PIN 6(0V)             --------------->           GND

GPIO引脚图

输出

输出图

注意

本Demo基于luma.example中的例子修改简化而成,

  • show_text.py为显示字符的程序
  • demo_opt.py是原example中的文件,用于获取屏幕信息
  • fonts文件夹中为字体文件,其中code2000.ttf支持中文(似乎支持所有语言的字符)

lumademo's People

Contributors

c-li avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.