Ultizin

codigo tela

Sep 20th, 2023
1,060
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. // Bibliotecas //
  2.  
  3. #include <Wire.h>
  4. #include <Adafruit_GFX.h>
  5. #include <Adafruit_SSD1306.h>
  6. #include <Fonts/FreeMonoOblique18pt7b.h>
  7.  
  8. //Tamanho da Tela
  9.  
  10. #define SCREEN_WIDTH 128
  11. #define SCREEN_HEIGHT 64
  12.  
  13. // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
  14. Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
  15.  
  16. void setup() {
  17.   Serial.begin(115200);
  18.  
  19.   if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3D for 128x64
  20.     Serial.println(F("SSD1306 allocation failed"));
  21.     for (;;);
  22.   }
  23.   delay(2000);
  24.   display.setFont(&FreeMonoOblique18pt7b);
  25.   display.clearDisplay();
  26.  
  27.   display.setTextSize(1);
  28.   display.setTextColor(WHITE);
  29.   display.setCursor(1, 20);
  30.   // Display static text
  31.   display.println("amogus");
  32.   display.display();
  33. }
  34.  
  35. void loop() {
  36.   // Scroll in various directions, pausing in-between:
  37.   display.startscrollright(0x00, 0x0F);
  38.   delay(2000);
  39.   display.invertDisplay(true);
  40.   delay(2000);
  41.   display.invertDisplay(false);
  42.   delay(2000);
  43. }
Advertisement
Add Comment
Please, Sign In to add comment