ขนาดวิดีโอ: 1280 X 720853 X 480640 X 360
แสดงแผงควบคุมโปรแกรมเล่น
เล่นอัตโนมัติ
เล่นใหม่
8-pin OLED Display Code:#include #include #include #include #include "Adafruit_VL53L1X.h"#define SCREEN_WIDTH 128#define SCREEN_HEIGHT 64#define OLED_MOSI 9#define OLED_CLK 10#define OLED_DC 11#define OLED_CS 12#define OLED_RESET 13#define XSHUT_PIN 3#define IRQ_PIN 2Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);Adafruit_VL53L1X vl53 = Adafruit_VL53L1X(XSHUT_PIN, IRQ_PIN);void setup() { if (!display.begin(SSD1306_SWITCHCAPVCC)) { while (1); } display.clearDisplay(); display.setTextSize(1); display.setTextColor(SSD1306_WHITE); display.setCursor(0, 0); display.println("Display OK"); display.display(); delay(1000); Wire.begin(); if (!vl53.begin(0x29, &Wire)) { display.clearDisplay(); display.setCursor(0, 0); display.println("VL53L1X Error"); display.display(); while (1); } vl53.startRanging(); display.clearDisplay(); display.setCursor(0, 0); display.println("VL53L1X Ready"); display.display(); delay(1000);}void loop() { int16_t distance; if (vl53.dataReady()) { distance = vl53.distance(); if (distance == -1) { display.clearDisplay(); display.setCursor(0, 0); display.setTextSize(1); display.println("Error Reading"); display.display(); } else { int distance_cm = distance / 10; display.clearDisplay(); display.setTextSize(2); display.setCursor(0, 0); display.println("Distance:"); display.setTextSize(3); display.setCursor(10, 30); display.print(distance_cm); display.println(" cm"); display.display(); } vl53.clearInterrupt(); } delay(100); }
I don't know why but that seems something a horror game could use
marco ma sei crazy 500 views
Thanks❤️😅
4-pin OLED Display Code:#include #include #include #include "Adafruit_VL53L1X.h"#define SCREEN_WIDTH 128#define SCREEN_HEIGHT 64#define OLED_I2C_ADDRESS 0x3C#define XSHUT_PIN 3#define IRQ_PIN 2Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);Adafruit_VL53L1X vl53 = Adafruit_VL53L1X(XSHUT_PIN, IRQ_PIN);void setup() { if (!display.begin(SSD1306_SWITCHCAPVCC, OLED_I2C_ADDRESS)) { while (1); } display.clearDisplay(); display.setTextSize(1); display.setTextColor(SSD1306_WHITE); display.setCursor(0, 0); display.println("Display OK"); display.display(); delay(1000); Wire.begin(); if (!vl53.begin(0x29, &Wire)) { display.clearDisplay(); display.setCursor(0, 0); display.println("VL53L1X Error"); display.display(); while (1); } vl53.startRanging(); display.clearDisplay(); display.setCursor(0, 0); display.println("VL53L1X Ready"); display.display(); delay(1000);}void loop() { int16_t distance; if (vl53.dataReady()) { distance = vl53.distance(); if (distance == -1) { display.clearDisplay(); display.setCursor(0, 0); display.setTextSize(1); display.println("Error Reading"); display.display(); } else { int distance_cm = distance / 10; display.clearDisplay(); display.setTextSize(2); display.setCursor(0, 0); display.println("Distance:"); display.setTextSize(3); display.setCursor(10, 30); display.print(distance_cm); display.println(" cm"); display.display(); } vl53.clearInterrupt(); } delay(100); }
8-pin OLED Display Code:
#include
#include
#include
#include
#include "Adafruit_VL53L1X.h"
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_MOSI 9
#define OLED_CLK 10
#define OLED_DC 11
#define OLED_CS 12
#define OLED_RESET 13
#define XSHUT_PIN 3
#define IRQ_PIN 2
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);
Adafruit_VL53L1X vl53 = Adafruit_VL53L1X(XSHUT_PIN, IRQ_PIN);
void setup() {
if (!display.begin(SSD1306_SWITCHCAPVCC)) {
while (1);
}
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(0, 0);
display.println("Display OK");
display.display();
delay(1000);
Wire.begin();
if (!vl53.begin(0x29, &Wire)) {
display.clearDisplay();
display.setCursor(0, 0);
display.println("VL53L1X Error");
display.display();
while (1);
}
vl53.startRanging();
display.clearDisplay();
display.setCursor(0, 0);
display.println("VL53L1X Ready");
display.display();
delay(1000);
}
void loop() {
int16_t distance;
if (vl53.dataReady()) {
distance = vl53.distance();
if (distance == -1) {
display.clearDisplay();
display.setCursor(0, 0);
display.setTextSize(1);
display.println("Error Reading");
display.display();
} else {
int distance_cm = distance / 10;
display.clearDisplay();
display.setTextSize(2);
display.setCursor(0, 0);
display.println("Distance:");
display.setTextSize(3);
display.setCursor(10, 30);
display.print(distance_cm);
display.println(" cm");
display.display();
}
vl53.clearInterrupt();
}
delay(100);
}
I don't know why but that seems something a horror game could use
marco ma sei crazy 500 views
Thanks❤️😅
4-pin OLED Display Code:
#include
#include
#include
#include "Adafruit_VL53L1X.h"
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_I2C_ADDRESS 0x3C
#define XSHUT_PIN 3
#define IRQ_PIN 2
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
Adafruit_VL53L1X vl53 = Adafruit_VL53L1X(XSHUT_PIN, IRQ_PIN);
void setup() {
if (!display.begin(SSD1306_SWITCHCAPVCC, OLED_I2C_ADDRESS)) {
while (1);
}
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SSD1306_WHITE);
display.setCursor(0, 0);
display.println("Display OK");
display.display();
delay(1000);
Wire.begin();
if (!vl53.begin(0x29, &Wire)) {
display.clearDisplay();
display.setCursor(0, 0);
display.println("VL53L1X Error");
display.display();
while (1);
}
vl53.startRanging();
display.clearDisplay();
display.setCursor(0, 0);
display.println("VL53L1X Ready");
display.display();
delay(1000);
}
void loop() {
int16_t distance;
if (vl53.dataReady()) {
distance = vl53.distance();
if (distance == -1) {
display.clearDisplay();
display.setCursor(0, 0);
display.setTextSize(1);
display.println("Error Reading");
display.display();
} else {
int distance_cm = distance / 10;
display.clearDisplay();
display.setTextSize(2);
display.setCursor(0, 0);
display.println("Distance:");
display.setTextSize(3);
display.setCursor(10, 30);
display.print(distance_cm);
display.println(" cm");
display.display();
}
vl53.clearInterrupt();
}
delay(100);
}