Display OLED 128x64 - 0.96" SPI

Display OLED 128x64 - 0.96" Mareste

Produs nou

Display OLED 0.96"

Mai multe detalii

82 Produse in stoc

6,00€ Fără TVA

Descrierea produsului:

Acesta este un display OLED cu contrast ridicat, cu rezoluție de 128x64 pixeli. Controlul afișajului este realizat prin SPI.

Specificatii tehnice:

128x64 pixeli

Interfață SPI

Alimentare de 3.3V

Dimensiunea 27 mm x 28 mm

Suprafață vizuală: 23,74 x 12,86 mm

Zonă activă: 21,75 x 10,85  mm

Dimensiune diagonală: 0,96 "

Punctul (Pixel): 0.17x0.17mm

Afișaj driver: SSD1306

Raport de contrast (tip): 2000: 1

Interval de vizualizare: Stânga: 80.0, dreapta: 80.0, Sus: 80.0, Jos: 80.0 grade

Aspect: Alb pe negru

Luminozitate (tip): 120cd / m2

Exemplu de conexiune:

Iată conexiunile SPI pentru placile compatibile UNO

  OLED -------- UNO

   GND -------- GND

   VCC -------- 3.3V

   SDA/D1 -------- D11 (MOSI) (nu se schimba)

   SCL/D0 -------- D13 (SCK) (nu se modifică)

   D/C -------- D8 (poate fi orice pin digital)

   RES -------- D9 (poate fi orice PIN digital) 

   CS -------- D10 (acest pin lipseste in varianta de display cu 6 pini si poate fi lasat neconectat

Exemplu cod

#include <SPI.h> // Include SPI if you're using SPI
#include <HT_SSD1306.h> // Include the HT_SSD1306 library

//////////////////////////
// SSD1306 Definition //
//////////////////////////
#define PIN_RESET 9 // Connect RST to pin 9
#define PIN_DC 8 // Connect DC to pin 8
#define PIN_CS 10 // Connect CS to pin 10
#define PIN_SCK 13 // Connect SCL/D0 to pin 13
#define PIN_MOSI 11 // Connect SDA/D1 to pin 11

//////////////////////////////////
// SSD1306 Object Declaration //
//////////////////////////////////
SSD1306 oled(PIN_RESET, PIN_DC, PIN_CS); // SPI Example

// Use these variables to set the initial time
int hours = 15;
int minutes = 22;
int seconds = 30;

// How fast do you want the clock to spin? Set this to 1 for fun.
// Set this to 1000 to get _about_ 1 second timing.
const int CLOCK_SPEED = 1000;

// Global variables to help draw the clock face:
const int MIDDLE_Y = oled.getLCDHeight() / 2;
const int MIDDLE_X = oled.getLCDWidth() / 2;

int CLOCK_RADIUS;
int POS_12_X, POS_12_Y;
int POS_3_X, POS_3_Y;
int POS_6_X, POS_6_Y;
int POS_9_X, POS_9_Y;
int S_LENGTH;
int M_LENGTH;
int H_LENGTH;

unsigned long lastDraw = 0;

void initClockVariables()
{
// Calculate constants for clock face component positions:
oled.setFontType(0);
CLOCK_RADIUS = min(MIDDLE_X, MIDDLE_Y) - 1;
POS_12_X = MIDDLE_X - oled.getFontWidth();
POS_12_Y = MIDDLE_Y - CLOCK_RADIUS + 2;
POS_3_X = MIDDLE_X + CLOCK_RADIUS - oled.getFontWidth() - 1;
POS_3_Y = MIDDLE_Y - oled.getFontHeight()/2;
POS_6_X = MIDDLE_X - oled.getFontWidth()/2;
POS_6_Y = MIDDLE_Y + CLOCK_RADIUS - oled.getFontHeight() - 1;
POS_9_X = MIDDLE_X - CLOCK_RADIUS + oled.getFontWidth() - 2;
POS_9_Y = MIDDLE_Y - oled.getFontHeight()/2;

// Calculate clock arm lengths
S_LENGTH = CLOCK_RADIUS - 2;
M_LENGTH = S_LENGTH * 0.7;
H_LENGTH = S_LENGTH * 0.5;
}

void setup()
{
oled.begin(); // Initialize the OLED
oled.clear(PAGE); // Clear the display's internal memory
oled.clear(ALL); // Clear the library's display buffer
oled.logo();
oled.display(); // Display what's in the buffer (splashscreen)
delay(2000);
initClockVariables();

oled.clear(ALL);
drawFace();
drawArms(hours, minutes, seconds);
oled.display(); // display the memory buffer drawn
}

void loop()
{

// Check if we need to update seconds, minutes, hours:
if (lastDraw + CLOCK_SPEED < millis())
{
lastDraw = millis();
// Add a second, update minutes/hours if necessary:
updateTime();

// Draw the clock:
oled.clear(PAGE); // Clear the buffer
drawFace(); // Draw the face to the buffer
drawArms(hours, minutes, seconds); // Draw arms to the buffer
oled.display(); // Draw the memory buffer
}
}

// Simple function to increment seconds and then increment minutes
// and hours if necessary.
void updateTime()
{
seconds++; // Increment seconds
if (seconds >= 60) // If seconds overflows (>=60)
{
seconds = 0; // Set seconds back to 0
minutes++; // Increment minutes
if (minutes >= 60) // If minutes overflows (>=60)
{
minutes = 0; // Set minutes back to 0
hours++; // Increment hours
if (hours >= 12) // If hours overflows (>=12)
{
hours = 0; // Set hours back to 0
}
}
}
}

// Draw the clock's three arms: seconds, minutes, hours.
void drawArms(int h, int m, int s)
{
double midHours; // this will be used to slightly adjust the hour hand
static int hx, hy, mx, my, sx, sy;

// Adjust time to shift display 90 degrees ccw
// this will turn the clock the same direction as text:
h -= 3;
m -= 15;
s -= 15;
if (h <= 0)
h += 12;
if (m < 0)
m += 60;
if (s < 0)
s += 60;

// Calculate and draw new lines:
s = map(s, 0, 60, 0, 360); // map the 0-60, to "360 degrees"
sx = S_LENGTH * cos(PI * ((float)s) / 180); // woo trig!
sy = S_LENGTH * sin(PI * ((float)s) / 180); // woo trig!
// draw the second hand:
oled.line(MIDDLE_X, MIDDLE_Y, MIDDLE_X + sx, MIDDLE_Y + sy);

m = map(m, 0, 60, 0, 360); // map the 0-60, to "360 degrees"
mx = M_LENGTH * cos(PI * ((float)m) / 180); // woo trig!
my = M_LENGTH * sin(PI * ((float)m) / 180); // woo trig!
// draw the minute hand
oled.line(MIDDLE_X, MIDDLE_Y, MIDDLE_X + mx, MIDDLE_Y + my);

midHours = minutes/12; // midHours is used to set the hours hand to middling levels between whole hours
h *= 5; // Get hours and midhours to the same scale
h += midHours; // add hours and midhours
h = map(h, 0, 60, 0, 360); // map the 0-60, to "360 degrees"
hx = H_LENGTH * cos(PI * ((float)h) / 180); // woo trig!
hy = H_LENGTH * sin(PI * ((float)h) / 180); // woo trig!
// draw the hour hand:
oled.line(MIDDLE_X, MIDDLE_Y, MIDDLE_X + hx, MIDDLE_Y + hy);
}

// Draw an analog clock face
void drawFace()
{
// Draw the clock border
oled.circle(MIDDLE_X, MIDDLE_Y, CLOCK_RADIUS);

// Draw the clock numbers
oled.setFontType(0); // set font type 0, please see declaration in SFE_MicroOLED.cpp
oled.setCursor(POS_12_X, POS_12_Y); // points cursor to x=27 y=0
oled.print(12);
oled.setCursor(POS_6_X, POS_6_Y);
oled.print(6);
oled.setCursor(POS_9_X, POS_9_Y);
oled.print(9);
oled.setCursor(POS_3_X, POS_3_Y);
oled.print(3);
}

Continutul coletului:

1x Display OLED 128x64 - 0.96" SPI
1x Bareta 6 pini tata

Nu sunt review-uri în acest moment.

Scrie un review (doar daca ai cumparat produsul, pentru intrebari sau nelamuriri foloseste pagina de contact)

Display OLED 128x64 - 0.96" SPI

Display OLED 128x64 - 0.96" SPI

Display OLED 0.96"

30 alte produse în aceeași categorie: