[![Build Status](https://github.com/ThingPulse/esp8266-oled-ssd1306/actions/workflows/main.yml/badge.svg)](https://github.com/ThingPulse/esp8266-oled-ssd1306/actions)
# ThingPulse OLED SSD1306 (ESP8266/ESP32/Mbed-OS)
This is a driver for SSD1306 128x64, 128x32, 64x48 and 64x32 OLED displays running on the Arduino/ESP8266 & ESP32 and mbed-os platforms.
Can be used with either the I2C or SPI version of the display.
This library drives the OLED display included in the [ThingPulse IoT starter kit](https://thingpulse.com/product/esp8266-iot-electronics-starter-kit-weatherstation-planespotter-worldclock/) aka classic kit aka weather station kit.
[![ThingPulse ESP8266 WeatherStation Classic Kit](https://github.com/ThingPulse/esp8266-weather-station/blob/master/resources/ThingPulse-ESP8266-Weather-Station.jpeg?raw=true)](https://thingpulse.com/product/esp8266-iot-electronics-starter-kit-weatherstation-planespotter-worldclock/)
You can either download this library as a zip file and unpack it to your Arduino/libraries folder or find it in the Arduino library manager under "ESP8266 and ESP32 Oled Driver for SSD1306 display". For mbed-os a copy of the files are available as an mbed-os library.
It is also available as a [PlatformIO library](https://platformio.org/lib/show/2978/ESP8266%20and%20ESP32%20OLED%20driver%20for%20SSD1306%20displays/examples). Just execute the following command:
```
platformio lib install 2978
```
## Service level promise
<table><tr><td><img src="https://thingpulse.com/assets/ThingPulse-open-source-prime.png" width="150">
</td><td>This is a ThingPulse <em>prime</em> project. See our <a href="https://thingpulse.com/about/open-source-commitment/">open-source commitment declaration</a> for what this means.</td></tr></table>
## Credits
This library has initially been written by [Daniel Eichhorn](https://github.com/squix78). Many thanks go to [Fabrice Weinberg](https://github.com/FWeinb) for optimizing and refactoring many aspects of the library. Also many thanks to the many committers who helped to add new features and who fixed many bugs. Mbed-OS support and other improvements were contributed by [Helmut Tschemernjak](https://github.com/helmut64).
The init sequence for the SSD1306 was inspired by Adafruit's library for the same display.
## mbed-os
This library has been adopted to support the ARM mbed-os environment. A copy of this library is available in mbed-os under the name OLED_SSD1306 by Helmut Tschemernjak. An alternate installation option is to copy the following files into your mbed-os project: OLEDDisplay.cpp OLEDDisplay.h OLEDDisplayFonts.h OLEDDisplayUi.cpp OLEDDisplayUi.h SSD1306I2C.h
## Usage
Check out the examples folder for a few comprehensive demonstrations how to use the library. Also check out the [ESP8266 Weather Station](https://github.com/ThingPulse/esp8266-weather-station) library which uses the OLED library to display beautiful weather information.
## Upgrade
The API changed a lot with the 3.0 release. If you were using this library with older versions please have a look at the [Upgrade Guide](UPGRADE-3.0.md).
Going from 3.x version to 4.0 a lot of internals changed and compatibility for more displays was added. Please read the [Upgrade Guide](UPGRADE-4.0.md).
## Features
* Draw pixels at given coordinates
* Draw lines from given coordinates to given coordinates
* Draw or fill a rectangle with given dimensions
* Draw Text at given coordinates:
* Define Alignment: Left, Right and Center
* Set the Fontface you want to use (see section Fonts below)
* Limit the width of the text by an amount of pixels. Before this widths will be reached, the renderer will wrap the text to a new line if possible
* Display content in automatically side scrolling carousel
* Define transition cycles
* Define how long one frame will be displayed
* Draw the different frames in callback methods
* One indicator per frame will be automatically displayed. The active frame will be displayed from inactive once
## Fonts
Fonts are defined in a proprietary but open format. You can create new font files by choosing from a given list
of open sourced Fonts from this web app: http://oleddisplay.squix.ch
Choose the font family, style and size, check the preview image and if you like what you see click the "Create" button. This will create the font array in a text area form where you can copy and paste it into a new or existing header file.
![FontTool](https://github.com/squix78/esp8266-oled-ssd1306/raw/master/resources/FontTool.png)
## Hardware Abstraction
The library supports different protocols to access the OLED display. Currently there is support for I2C using the built in Wire.h library, I2C by using the much faster [BRZO I2C library](https://github.com/pasko-zh/brzo_i2c) written in assembler and it also supports displays which come with the SPI interface.
### I2C with Wire.h
```C++
#include <Wire.h>
#include "SSD1306Wire.h"
// for 128x64 displays:
SSD1306Wire display(0x3c, SDA, SCL); // ADDRESS, SDA, SCL
// for 128x32 displays:
// SSD1306Wire display(0x3c, SDA, SCL, GEOMETRY_128_32); // ADDRESS, SDA, SCL, GEOMETRY_128_32 (or 128_64)
// for using 2nd Hardware I2C (if available)
// SSD1306Wire(0x3c, SDA, SCL, GEOMETRY_128_64, I2C_TWO); //default value is I2C_ONE if not mentioned
// By default SD1306Wire set I2C frequency to 700000, you can use set either another frequency or skip setting the frequency by providing -1 value
// SSD1306Wire(0x3c, SDA, SCL, GEOMETRY_128_64, I2C_ONE, 400000); //set I2C frequency to 400kHz
// SSD1306Wire(0x3c, SDA, SCL, GEOMETRY_128_64, I2C_ONE, -1); //skip setting the I2C bus frequency
```
for a SH1106:
```C++
#include <Wire.h>
#include "SH1106Wire.h"
SH1106Wire display(0x3c, SDA, SCL); // ADDRESS, SDA, SCL
// By default SH1106Wire set I2C frequency to 700000, you can use set either another frequency or skip setting the frequency by providing -1 value
// SH1106Wire(0x3c, SDA, SCL, GEOMETRY_128_64, I2C_ONE, 400000); //set I2C frequency to 400kHz
// SH1106Wire(0x3c, SDA, SCL, GEOMETRY_128_64, I2C_ONE, -1); //skip setting the I2C bus frequency
```
### I2C with brzo_i2c
```C++
#include <brzo_i2c.h>
#include "SSD1306Brzo.h"
SSD1306Brzo display(0x3c, SDA, SCL); // ADDRESS, SDA, SCL
```
or for the SH1106:
```C++
#include <brzo_i2c.h>
#include "SH1106Brzo.h"
SH1106Brzo display(0x3c, SDA, SCL); // ADDRESS, SDA, SCL
```
### SPI
```C++
#include <SPI.h>
#include "SSD1306Spi.h"
SSD1306Spi display(D0, D2, D8); // RES, DC, CS
```
or for the SH1106:
```C++
#include <SPI.h>
#include "SH1106Spi.h"
SH1106Spi display(D0, D2); // RES, DC
```
## API
### Display Control
```C++
// Initialize the display
void init();
// Free the memory used by the display
void end();
// Cycle through the initialization
void resetDisplay(void);
// Connect again to the display through I2C
void reconnect(void);
// Turn the display on
void displayOn(void);
// Turn the display offs
void displayOff(void);
// Clear the local pixel buffer
void clear(void);
// Write the buffer to the display memory
void display(void);
// Inverted display mode
void invertDisplay(void);
// Normal display mode
void normalDisplay(void);
// Set display contrast
// really low brightness & contrast: contrast = 10, precharge = 5, comdetect = 0
// normal brightness & contrast: contrast = 100
void setContrast(uint8_t contrast, uint8_t precharge = 241, uint8_t comdetect = 64);
// Convenience method to access
void setBrightness(uint8_t);
// Turn the display upside down
void flipScreenVertically();
// Draw the screen mirrored
void mirrorScreen();
```
## Pixel drawing
```C++
/* Drawing functions */
// Sets the color of all pixel operations
// color : BLACK, WHITE, INVERSE
void setColor(OLEDDISPLAY_COLOR color);
// Draw a pixel at given position
void setPixel(int16_t x, int16_t y);
// Draw a line from position 0 to position 1
void drawLine(int16_t x0, int16_t y0, int16_t x1, int16_t y1);
// Draw the border of a rectangle at the given
没有合适的资源?快使用搜索试试~ 我知道了~
一种使用ESP-NOW、LoRa和其他协议在偏远地区传输传感器数据而不依赖WiFi的系统。.zip
共133个文件
h:60个
ino:36个
png:9个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 116 浏览量
2023-03-29
23:18:09
上传
评论
收藏 2.21MB ZIP 举报
温馨提示
一种使用ESP-NOW、LoRa和其他协议在偏远地区传输传感器数据而不依赖WiFi的系统。.zip
资源推荐
资源详情
资源评论
收起资源包目录
一种使用ESP-NOW、LoRa和其他协议在偏远地区传输传感器数据而不依赖WiFi的系统。.zip (133个子文件)
OLEDDisplay.cpp 34KB
OLEDDisplayUi.cpp 15KB
OLEDDisplayFonts.h 103KB
fdrs_gateway_lora.h 21KB
fdrs_node_lora.h 20KB
OLEDDisplay.h 12KB
fdrs_checkConfig.h 11KB
fdrs_node.h 8KB
fdrs_gateway_espnow.h 8KB
OLEDDisplayUi.h 8KB
SSD1306Wire.h 7KB
SH1106Wire.h 7KB
SSD1306Brzo.h 5KB
fdrs_gateway_filesystem.h 5KB
SSD1306Spi.h 5KB
SSD1306I2C.h 5KB
fdrs_gateway_mqtt.h 4KB
SH1106Spi.h 4KB
fdrs_gateway.h 4KB
SH1106Brzo.h 4KB
fdrs_node_espnow.h 3KB
fdrs_gateway_wifi.h 2KB
fdrs_datatypes.h 2KB
images.h 2KB
fdrs_gateway_config.h 2KB
fdrs_gateway_config.h 2KB
fdrs_gateway_config.h 2KB
fdrs_gateway_config.h 2KB
fdrs_oled.h 2KB
fdrs_gateway_config.h 2KB
images.h 2KB
images.h 2KB
SSD1306.h 2KB
SH1106.h 2KB
fdrs_globals.h 1KB
fdrs_gateway_serial.h 1KB
fdrs_node_config.h 890B
fdrs_gateway_scheduler.h 839B
fdrs_node_config.h 717B
fdrs_node_config.h 709B
fdrs_node_config.h 625B
fdrs_node_config.h 623B
fdrs_node_config.h 620B
fdrs_node_config.h 599B
fdrs_node_config.h 597B
fdrs_node_config.h 595B
fdrs_node_config.h 595B
fdrs_node_config.h 568B
fdrs_node_config.h 566B
fdrs_node_config.h 566B
fdrs_node_config.h 566B
fdrs_node_config.h 566B
fdrs_node_config.h 566B
fdrs_node_config.h 566B
fdrs_node_config.h 566B
fdrs_node_config.h 566B
fdrs_node_config.h 566B
fdrs_node_config.h 565B
fdrs_node_config.h 564B
fdrs_node_config.h 563B
images.h 329B
fdrs_debug.h 234B
glyphEditor.html 25KB
platformio.ini 578B
SSD1306ClockDemo.ino 7KB
SSD1306DrawingDemo.ino 7KB
SSD1306UiDemo.ino 7KB
SSD1306SimpleDemo.ino 6KB
GenericGPS_fdrs.ino 6KB
Irrigation.ino 4KB
SSD1306OTADemo.ino 4KB
KisssysGypsum.ino 4KB
SSD1306ScrollVerticalDemo.ino 3KB
LilyGo_HiGrow_32.ino 3KB
FastLED.ino 3KB
SSD1306TwoScreenDemo.ino 2KB
TSL2561.ino 2KB
TFT_eSPI_fdrs.ino 2KB
FrequencyCounter.ino 1KB
DHT22_fdrs.ino 1KB
MESB_fdrs.ino 1KB
TippingBucket.ino 760B
AHT20_fdrs.ino 689B
ESPNOW_Sensor.ino 678B
MLX90614_fdrs.ino 631B
BMP280_fdrs.ino 621B
BME280_fdrs.ino 608B
SHT20_fdrs.ino 570B
LoRa_Sensor.ino 563B
CapacitiveSoil.ino 548B
1_MQTT_Gateway_Ethernet.ino 547B
DS18B20_fdrs.ino 545B
LoRa_Controller.ino 543B
ESPNOW_Controller.ino 543B
Single_Channel_Relay.ino 432B
ESPNOW_Stress_Test.ino 330B
2_ESPNOW_Repeater.ino 252B
3_LoRa_Repeater.ino 252B
0_MQTT_Gateway.ino 252B
1_UART_Gateway.ino 252B
共 133 条
- 1
- 2
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9154
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于QT+C++的智能云监护仪项目,能够实时显示使用者心电、血氧、血压波形及其它各种参数+源码(毕业设计&课程设计&项目开发)
- 基于java开发的app接收硬件端传输的心音信号,具有显示心音波形,发出心音的功能+源码(毕业设计&课程设计&项目开发)
- Python 程序语言设计模式思路-行为型模式:职责链模式:将请求从一个处理者传递到下一个处理者
- 9241703124789646.16健身系统2.apk
- postgresql-16.3-1-windows-x64.exe
- Python 程序语言设计模式思路-结构型模式:装饰器讲解及利用Python装饰器模式实现高效日志记录和性能测试
- 基于YOLOv5和DeepSORT的多目标跟踪仿真与记录
- Python 程序语言设计模式思路-创建型模式:原型模式:通过复制现有对象来创建新对象,面向对象编程
- 卸载软件geek卸载软件geek
- Python 程序语言设计模式思路-创建型模式:单例模式,确保一个类的唯一实例(装饰器)面向对象编程、继承
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功