Code Monkey home page Code Monkey logo

orangepi-ssd1306-i2c's Introduction

I have tested with the original 128x64 OLED Display from Orange Pi https://www.aliexpress.com/item/1005002035106789.html

IT works for all model of board. Bellow is original Readme

======================================

Orange Pi - SSD1306 128x64 OLED Display - C++ Code

Background

This project was an exercise in reinventing the wheel for the purpose of learning... There are already a number of libraries that allow you to write to these little 128x64 OLED displays, but that would be too easy (and wouldn't teach us anything), so I decided to write my own.

This is fork of https://github.com/kjhughes097/pi-ssd1306-oled

Features

The current version allows you to instantiate a 'SSD1306' object and use that to send text to the display.Here's a few of the other features:

  • LINE WRAP - If enabled (off by default) it allows lines of text that are longer than the display can show on one line to wrap onto the next line.
  • SCROLL - If enabled (on by default) then if a new line of text is to be displayed and the screen is 'full' at the moment then the existing text will scroll up (top line disappears) and the new line will be displayed/appended to the bottom.
  • CLEAR - Blanks the display, removing all text
  • DISPLAY - Currently it supports all letters (A-Z), lowercase characters are converted to uppercase. It also supports numbers and the folloing punctuation: !"#$%&'()*+,-./:;<=>?@[]^_` (and SPACE). Any other characters sent to it will be displayed as a small solid block.

Usage

Use of the code is as simple as including three files in your project (charmap.h, ssd1306.h, ssd1306.cpp). In your own code it is then a case of instantiating a SSD1306 object and using the key functions:

  • initDisplay() - Does the initialization, sets things up.
  • setWordWrap(int) - Configures the word wrap feature (0 = off, -1 = on)
  • setDisplayMode(SSD1306::Mode) - Configures screen scrolling, or wrapping (SSD1306::Mode::SCROLL or SSD1306::Mode::WRAP)
  • *textDisplay(const char message) - Sends the text to the device for displaying (e.g. textDisplay("GOOD MORNING !!"))
  • clearDisplay() - Blanks the whole screen.

There is a small sample app (oled.cpp) that shows how to instantiate and use the SSD1306 class. When compiled you can use this app to test the device out from the command line:

./oled -ww -t "A line of text" -t "A second line of text" -t "A long line of text that will wrap to the next line" - "Keep adding -t and text (in quotes) to the command line to see it scroll"

  • "-c" - Clear display
  • "-ww" - Set Word Wrap
  • "-t" - Some text

orangepi-ssd1306-i2c's People

Contributors

kjhughes097 avatar vansatchen avatar thanhtantran 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.