mirror of
https://gitlab.dit.htwk-leipzig.de/phillip.kuehne/dezibot.git
synced 2025-05-20 19:41:47 +02:00
display text test
This commit is contained in:
parent
50c760333e
commit
45101de54c
@ -19,21 +19,33 @@
|
|||||||
// On an arduino MEGA 2560: 20(SDA), 21(SCL)
|
// On an arduino MEGA 2560: 20(SDA), 21(SCL)
|
||||||
// On an arduino LEONARDO: 2(SDA), 3(SCL), ...
|
// On an arduino LEONARDO: 2(SDA), 3(SCL), ...
|
||||||
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
|
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
|
||||||
#define SCREEN_ADDRESS 0x3D ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
|
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
|
||||||
|
|
||||||
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
|
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
|
||||||
|
|
||||||
#define GPIO_LED 48
|
#define GPIO_LED 48
|
||||||
|
|
||||||
void Dezibot::begin(void) {
|
void Dezibot::begin(void) {
|
||||||
Adafruit_NeoPixel ledStrip = Adafruit_NeoPixel(3, GPIO_LED, NEO_GRB + NEO_KHZ800);
|
Adafruit_NeoPixel ledStrip = Adafruit_NeoPixel(3, GPIO_LED, NEO_GRB + NEO_KHZ800);
|
||||||
|
Wire.begin(1, 2);
|
||||||
if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
|
if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
|
||||||
Serial.println(F("SSD1306 allocation failed"));
|
Serial.println("SSD1306 allocation failed");
|
||||||
for (;;); // Don't proceed, loop forever
|
for (;;); // Don't proceed, loop forever
|
||||||
}
|
}
|
||||||
|
|
||||||
|
display.display();
|
||||||
|
vTaskDelay(2000);
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
|
vTaskDelay(2000);
|
||||||
|
|
||||||
|
// Draw a single pixel in white
|
||||||
display.drawPixel(10, 10, SSD1306_WHITE);
|
display.drawPixel(10, 10, SSD1306_WHITE);
|
||||||
|
|
||||||
|
// Show the display buffer on the screen. You MUST call display() after
|
||||||
|
// drawing commands to make them visible on screen!
|
||||||
|
display.display();
|
||||||
|
vTaskDelay(2000);
|
||||||
|
|
||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
Serial.println("start");
|
Serial.println("start");
|
||||||
|
|
||||||
@ -57,5 +69,14 @@ void Dezibot::begin(void) {
|
|||||||
|
|
||||||
Serial.println(time_us);
|
Serial.println(time_us);
|
||||||
|
|
||||||
|
display.clearDisplay();
|
||||||
|
|
||||||
|
display.setTextSize(2); // Draw 2X-scale text
|
||||||
|
display.setTextColor(SSD1306_WHITE);
|
||||||
|
display.setCursor(10, 0);
|
||||||
|
display.println(F("scroll"));
|
||||||
|
display.display(); // Show initial text
|
||||||
|
vTaskDelay(1000);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user