- مخطط الرسم البياني :
- تحميل الكود أردوينو :
// Project : How to Display OLED with LM35 with Arduino
// By : DIY Channel
// My Youtube Channel : https://www.youtube.com/c/DIYChannel2019
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET 4
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
#define LM35 A0
float temperature = 0;
float value = 0;
float voltage = 0;
const unsigned char myBitmapMaker [] PROGMEM = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff,
0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xfe, 0x00, 0x10, 0x07, 0xc1, 0x83, 0xc0, 0x78, 0x00, 0xfc, 0x06, 0x03, 0x80, 0x7f, 0xff,
0xff, 0xfe, 0x00, 0x10, 0x01, 0xc0, 0x83, 0x80, 0x30, 0x00, 0x7c, 0x06, 0x01, 0x00, 0x3f, 0xff,
0xff, 0xfe, 0x00, 0x10, 0x00, 0xc0, 0x83, 0x00, 0x10, 0x00, 0x7c, 0x06, 0x01, 0x00, 0x3f, 0xff,
0xff, 0xfe, 0x00, 0x10, 0x00, 0xc0, 0x83, 0x00, 0x00, 0x00, 0x7c, 0x02, 0x01, 0x00, 0x3f, 0xff,
0xff, 0xff, 0x00, 0x10, 0x20, 0xc0, 0x83, 0x04, 0x08, 0x00, 0xfc, 0x02, 0x01, 0x00, 0x7f, 0xff,
0xff, 0xff, 0xc0, 0xf0, 0x20, 0xc0, 0x83, 0x04, 0x0f, 0x07, 0xfc, 0x02, 0x01, 0x03, 0xff, 0xff,
0xff, 0xff, 0xc0, 0xf0, 0x20, 0xc0, 0x83, 0x06, 0x1f, 0x07, 0xfc, 0x00, 0x01, 0x03, 0xff, 0xff,
0xff, 0xff, 0xc0, 0xf0, 0x20, 0xc0, 0x83, 0x01, 0xff, 0x07, 0xfc, 0x00, 0x01, 0x03, 0xff, 0xff,
0xff, 0xff, 0xc0, 0xf0, 0x00, 0xc0, 0x83, 0x00, 0xff, 0x07, 0xfc, 0x00, 0x01, 0x00, 0x7f, 0xff,
0xff, 0xff, 0xc0, 0xf0, 0x01, 0xc0, 0x83, 0x80, 0x3f, 0x07, 0xfc, 0x00, 0x01, 0x00, 0x7f, 0xff,
0xff, 0xff, 0xc0, 0xf0, 0x01, 0xc0, 0x83, 0xc0, 0x1f, 0x07, 0xfc, 0x00, 0x01, 0x00, 0x7f, 0xff,
0xff, 0xff, 0xc0, 0xf0, 0x00, 0xc0, 0x83, 0xe0, 0x1f, 0x07, 0xfc, 0x00, 0x01, 0x00, 0x7f, 0xff,
0xff, 0xff, 0xc0, 0xf0, 0x20, 0xc0, 0x83, 0xf8, 0x0f, 0x07, 0xfc, 0x00, 0x01, 0x03, 0xff, 0xff,
0xff, 0xff, 0xc0, 0xf0, 0x20, 0xc0, 0x83, 0x04, 0x0f, 0x07, 0xfc, 0x00, 0x01, 0x03, 0xff, 0xff,
0xff, 0xff, 0xc0, 0xf0, 0x20, 0xc0, 0x83, 0x06, 0x0f, 0x07, 0xfc, 0x10, 0x01, 0x03, 0xff, 0xff,
0xff, 0xff, 0xc0, 0xf0, 0x20, 0xc0, 0x83, 0x06, 0x0f, 0x07, 0xfc, 0x10, 0x01, 0x03, 0xff, 0xff,
0xff, 0xff, 0xc0, 0xf0, 0x20, 0xc0, 0x83, 0x04, 0x0f, 0x07, 0xfc, 0x10, 0x01, 0x00, 0x3f, 0xff,
0xff, 0xff, 0xc0, 0xf0, 0x20, 0xc0, 0x03, 0x00, 0x0f, 0x07, 0xfc, 0x10, 0x81, 0x00, 0x3f, 0xff,
0xff, 0xff, 0xc0, 0xf0, 0x20, 0xe0, 0x07, 0x00, 0x1f, 0x07, 0xfc, 0x10, 0x81, 0x00, 0x3f, 0xff,
0xff, 0xff, 0xc0, 0xf0, 0x20, 0xf0, 0x0f, 0x80, 0x3f, 0x07, 0xfc, 0x10, 0x81, 0x00, 0x3f, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0x1f, 0xe0, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0x04, 0x41, 0x81, 0xfc, 0x0f, 0xe0, 0xc0, 0xe0, 0x70, 0x42, 0x01, 0x00, 0xff, 0xff,
0xff, 0xff, 0x04, 0x40, 0x81, 0xf8, 0x0f, 0xc0, 0x40, 0xc0, 0x70, 0x42, 0x01, 0x00, 0x7f, 0xff,
0xff, 0xff, 0x04, 0x40, 0x81, 0xf8, 0x0f, 0xc0, 0x40, 0xc0, 0x30, 0x42, 0x01, 0x00, 0x7f, 0xff,
0xff, 0xff, 0x04, 0x40, 0x81, 0xf8, 0x07, 0xc0, 0x40, 0xc0, 0x30, 0x02, 0x01, 0x00, 0x3f, 0xff,
0xff, 0xff, 0x04, 0xc0, 0x81, 0xf8, 0x07, 0xc0, 0x40, 0xc0, 0x30, 0x06, 0x0f, 0x00, 0x3f, 0xff,
0xff, 0xff, 0x05, 0xc0, 0x01, 0xf8, 0x07, 0xc0, 0x00, 0xc0, 0x30, 0x06, 0x0f, 0x00, 0x3f, 0xff,
0xff, 0xff, 0x07, 0xc0, 0x01, 0xf8, 0x07, 0xc0, 0x00, 0xc0, 0x30, 0x06, 0x03, 0x00, 0x3f, 0xff,
0xff, 0xff, 0x07, 0xc0, 0x01, 0xf0, 0x07, 0xc0, 0x00, 0xc0, 0x30, 0x0e, 0x01, 0x00, 0x7f, 0xff,
0xff, 0xff, 0x07, 0xc0, 0x01, 0xf0, 0x07, 0xc0, 0x00, 0xc0, 0x30, 0x0e, 0x01, 0x00, 0xff, 0xff,
0xff, 0xff, 0x07, 0xc0, 0x01, 0xf0, 0x87, 0xc0, 0x00, 0x80, 0x10, 0x06, 0x01, 0x00, 0x3f, 0xff,
0xff, 0xff, 0x07, 0xc0, 0x01, 0xf0, 0x83, 0xc0, 0x00, 0x80, 0x10, 0x06, 0x0f, 0x00, 0x3f, 0xff,
0xff, 0xff, 0x07, 0xc0, 0x01, 0xf0, 0x03, 0xc0, 0x00, 0x80, 0x10, 0x06, 0x0f, 0x00, 0x3f, 0xff,
0xff, 0xff, 0x07, 0xc0, 0x01, 0xf0, 0x03, 0xc0, 0x10, 0x80, 0x10, 0x02, 0x0f, 0x00, 0x3f, 0xff,
0xff, 0xff, 0x07, 0xc0, 0x21, 0xf0, 0x03, 0xc0, 0x10, 0x80, 0x10, 0x02, 0x01, 0x00, 0x3f, 0xff,
0xff, 0xff, 0x07, 0xc2, 0x21, 0xf0, 0xc3, 0xc0, 0x10, 0x82, 0x10, 0x42, 0x01, 0x00, 0x3f, 0xff,
0xff, 0xff, 0x07, 0xc2, 0x21, 0xe0, 0xc3, 0xc1, 0x10, 0x86, 0x00, 0x42, 0x01, 0x00, 0x3f, 0xff,
0xff, 0xff, 0x07, 0xc2, 0x21, 0xf0, 0xc3, 0xe3, 0x10, 0x86, 0x10, 0x40, 0x01, 0x0c, 0x3f, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff,
0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff
};
void setup() {
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;);
}
display.clearDisplay();
display.drawBitmap(0, 0, myBitmapMaker, 128, 64, WHITE);
display.display();
delay(2000);
display.clearDisplay();
pinMode(LM35, INPUT);
}
void loop() {
displayTemp();
}
void displayTemp() {
value = analogRead(A0);
voltage = value * 0.00488;
temperature = voltage * 100;
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(20, 10);
display.print("Room Temperature");
display.setCursor(15, 30);
display.setTextSize(3);
display.print(temperature);
display.print("C");
display.display();
delay(1000);
}
-----------------------------------------------------------
oled,oled display,arduino lm35 temperature sensor with lcd display,oled i2c,oled i2c display with arduino,arduino oled display,oled 0.96' display review,ssd1306 oled,driving oled display arduino,arduino projects display oled,arduino i2c oled,arduino temperature sensor with oled display,tutorial on i2c oled display with arduino/nodemcu,oled display 128x64,128x64 oled arduino,oled display arduino,pantalla oled arduino,arduino: 0.96' i2c oled,arduino lm35 temperature sensor with lcd display code
No comments:
Post a Comment