Advertisement
Guest User

Untitled

a guest
May 21st, 2020
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. #include <U8g2lib.h>
  2. #include <Wire.h>
  3.  
  4.  
  5. U8G2_SH1106_128X64_NONAME_F_HW_I2C OLED1(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
  6. U8G2_SH1106_128X64_NONAME_F_HW_I2C OLED2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
  7.  
  8. void setup() {
  9. /*
  10.   pinMode(9, OUTPUT);
  11.   digitalWrite(9, 0);   // default output in I2C mode for the SSD1306 test shield: set the i2c adr to 0
  12. */
  13.  
  14.   OLED1.setI2CAddress(0x3C * 2);//I2Cアドレスを2倍して指定する仕様
  15.   OLED1.begin();
  16.  
  17.   OLED2.setI2CAddress(0x3D * 2);
  18.   OLED2.begin();
  19. }
  20.  
  21.  
  22. void loop(void) {
  23.   OLED1.clearBuffer();
  24.   OLED1.setFontMode(1);  // Transparent
  25.   OLED1.setFontDirection(0);
  26.   OLED1.setFont(u8g2_font_inb24_mf);
  27.   OLED1.drawStr(0, 30, "1st");
  28.   OLED1.sendBuffer();
  29.  
  30.  
  31.   delay(1000);
  32.  
  33.   OLED2.clearBuffer();
  34.   OLED2.setFontMode(1);  // Transparent
  35.   OLED2.setFontDirection(0);
  36.   OLED2.setFont(u8g2_font_inb24_mf);
  37.   OLED2.drawStr(0, 30, "2nd");
  38.   OLED2.sendBuffer();
  39.  
  40.   delay(1000);
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement