9
Mục lục
ESP32 0.96Inch OLED V2.0 Module có thiết kế nhỏ gọn, được tích hợp màn hình Oled 0.96 inch độ phân giải 128 x 64 pixel hiển thị chuyên nghiệp cùng với socket gắn pin và thiết kế phần cứng tối ưu cho độ cơ động, độ bền và độ ổn định cao.
Thông số kỹ thuật
- IC chính: ESP32 ARM SoC Wifi BLE.
- Tích hợp Oled 0.96 inch độ phân giải 128 x 64 pixel, Driver SSD1306 giao tiếp I2C. Màu trắng
- Cấp nguồn: 5VDC MicroUSB hoặc Jack nguồn Pin Lipo 3.7~4.2VDC.
- GIPO giao tiếp mức 3.3VDC
- Tích hợp Led báo trạng thái, nút Reset, Program.
- Tương thích hoàn toàn với trình biên dịch Arduino.
Pin map
Phần cứng cần thiết
Thư viện
Sơ đồ kết nối với mạch nạp (USB TTL)
Code
#include "WiFi.h"
#include "Wire.h"
#include "SSD1306.h"
SSD1306 display (0x3c, 21, 22);
void setup()
{
Serial.begin(115200);
// Set WiFi to station mode and disconnect from an AP if it was previously connected
WiFi.mode(WIFI_STA);
WiFi.disconnect();
delay(100);
Serial.println("Setup done");
display.init();
display.flipScreenVertically ();
display.clear();
display.setTextAlignment (TEXT_ALIGN_LEFT);
display.setFont(ArialMT_Plain_10);
}
void loop()
{
Serial.println("scan start");
display.setColor(BLACK);
display.fillRect(0,0,127,10);
display.setColor(WHITE);
display.drawString(0, 0, "Scanning... ");
display.display();
// WiFi.scanNetworks will return the number of networks found
int n = WiFi.scanNetworks();
display.clear();
display.drawString(0, 0, "Scan results:");
display.display();
Serial.println("scan done");
if (n == 0) {
Serial.println("no networks found");
display.drawString(0,10,"No networks found");
} else {
Serial.print(n);
Serial.println(" networks found");
for (int i = 0; i < n; ++i) {
// Print SSID and RSSI for each network found
Serial.print(i + 1);
Serial.print(": ");
Serial.print(WiFi.SSID(i));
display.drawString( 0 , i*8+10 , String(WiFi.SSID(i)));
Serial.print(" (");
Serial.print(WiFi.RSSI(i));
display.drawString( 100 , i*8+10 ,String(WiFi.RSSI(i)));
Serial.print(")");
Serial.println((WiFi.encryptionType(i) == WIFI_AUTH_OPEN)?" ":"*");
delay(10);
}
}
Serial.println("");
display.display();
// Wait a bit before scanning again
delay(5000);
}



