所有訂單滿$50包本地平郵, 滿$500包順豐至工商區或順豐站,多謝惠顧!

0.96寸 OLED 顯示屏 I2C Arduino micro:bit

$58.00

商品說明

OLED (Organic Light-Emitting Diode) 又稱為有機電激光顯示。具備輕、薄、省電壽命長等特性,這種顯示器在很多電子裝置(如MP3機)得到廣泛應用。

 

技術規格:

尺寸: 29.5mm x 27.35mm
屏幕尺寸: 0.96
解像度: 128×64
可視角: >160
功耗: 0.06W
溫度: -30 – 70C
芯片: SSD1306

 

I2C接口:
Vcc: 2.2V-5.5V
GND: GND
SCL: CLK時鐘
SDA: MOSI數據

 

Arduino 使用教學:

www.instructables.com/id/Monochrome-096-i2c-OLED-display-with-arduino-SSD13/

 

Arduino Library:

github.com/adafruit/Adafruit-GFX-Library
github.com/adafruit/Adafruit_SSD1306

 

**Modify Adafruit_SSD1306.h Line #73 to be like
#define SSD1306_128_64
// #define SSD1306_128_32
// #define SSD1306_96_16

 

Arduino 示範代碼:

Voltage Sensor gist.github.com/hkstemclub/29ceae2c1e0029fc025ac2ffb537c865

/*
  Modify version of https://www.youtube.com/watch?v=7ph5ov56cfg
  Code will be used to display a bar graph from measured input voltage from pin A0.
  
  The purpose of this program is to test and demonstrate the display performance of the 128 x 64 display
  
  The display is a Balance world Inc 0.96" Inch Yellow and Blue I2c IIC Serial 128x64 Oled LCD Oled LED Module for
  Arduino Display 51 Msp420 Stim32 SCR
  This could tested with a Mega but should work with an UNO
  Kit hkstem.club
  Pin connections
  Arduino   device
  A0    Voltage read (10K pot across +5, and ground)
  A1
  A2
  A3
  A4    SDA (if no SDA pin)
  A5    SCL (if not SCL pin)
  1
  2
  3
  4
  5
  6
  7
  8
  9
  10
  11
  12
  13
  SDA   SDA
  SLC   SLC
  Graphics Libraries
  https://github.com/adafruit/Adafruit-GFX-Library
  https://github.com/adafruit/Adafruit_SSD1306
  Modify Adafruit_SSD1306.h Line #73 to be like
     #define SSD1306_128_64
//   #define SSD1306_128_32
//   #define SSD1306_96_16
  display buy:
  http://hkstem.club/product/096oled
*/

#include <SPI.h>
#include <Wire.h>

#include <Adafruit_SSD1306.h>

#define OLED_RESET 4
#define ADJ_PIN A0
Adafruit_SSD1306 Display(OLED_RESET);

int r = 0;
int i = 0;

void setup()   {


  Display.begin(SSD1306_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x32)

  // i'll follow the license agreement and display the Adafruit logo
  // and since they were nice enough to supply the libraries
  Display.clearDisplay();
  Display.display();
  delay (1000);

  DrawTitles();

}


void loop() {

  // get some dummy data to display


  //r = rand() / 220;
  r = analogRead(ADJ_PIN);
  r = r / 7.98;

  Display.setTextSize(2);
  // note set the background color or the old text will still display
  Display.setTextColor(WHITE, BLACK);
  Display.setCursor(0, 33);
  Display.println(Format(r * 7.99 / 204.6 , 3, 2));

  //draw the bar graph
  Display.fillRect(r, 50, 128 - r, 10, BLACK);
  Display.fillRect(3, 50, r, 10, WHITE);

  for (i = 1; i < 13; i++) {
    Display.fillRect(i * 10, 50, 2, 10, BLACK);
  }

  // now that the display is build, display it...
  Display.display();


}


void DrawTitles(void) {

  Display.setTextSize(2);
  Display.setTextColor(WHITE);
  Display.setCursor(0, 0);
  Display.println("Voltage");

  Display.setTextSize(1);
  Display.setTextColor(WHITE);
  Display.setCursor(0, 19);
  Display.println("hkstem.club");
  //Display.println("Random number");
  Display.display();

}


String Format(double val, int dec, int dig ) {

  // this is my simple way of formatting a number
  // data = Format(number, digits, decimals) when needed

  int addpad = 0;
  char sbuf[20];
  String fdata = (dtostrf(val, dec, dig, sbuf));
  int slen = fdata.length();
  for ( addpad = 1; addpad <= dec + dig - slen; addpad++) {
    fdata = " " + fdata;
  }
  return (fdata);

}

 

 

 

Micro:bit 使用教學 makecode.microbit.org/pkg/Tinkertanker/pxt-oled-ssd1306:

  • Advanced -> Add Package -> https://github.com/Tinkertanker/pxt-oled-ssd1306

 

Micro:Bit Reference:

makecode.microbit.org/pkg/Tinkertanker/pxt-oled-ssd1306

hackernoon.com/the-first-video-game-on-the-bbc-micro-bit-probably-4175fab44da8

www.instructables.com/id/HackerBox-0022-BBC-MicroBit/

 

 

 

 

 

商品評價

目前沒有評價。

只有註冊並且購買過商品的顧客才能撰寫評價。