Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Arduino IDE demo source code for KC868-A6]--#06-OLED_SSD1306_code
#1
Heart 
[Arduino IDE demo source code for KC868-A6]--#06-OLED_SSD1306_code

Code:
/*OLED SSD1306 Code for KC868-A6*/

#include <U8g2lib.h>
#include <Wire.h>

U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0,  15, 4, U8X8_PIN_NONE);//SCL IO15  SDA  IO4

void page1() {
  u8g2.setFont(u8g2_font_timR18_tf);// Font 18
  u8g2.setFontPosTop();
  u8g2.setCursor(5,0);
  u8g2.print("KINCONY");
  u8g2.setFont(u8g2_font_timR12_tf);//Font 12
  u8g2.setCursor(0,40);
  u8g2.print("www.kincony.com");
}
void setup(){
  u8g2.setI2CAddress(0x3C*2);
  u8g2.begin();
  u8g2.enableUTF8Print();
}
void loop(){
  u8g2.firstPage();
  do
  {
    page1();
  }while(u8g2.nextPage());

}
   
.zip   6.OLED-1306.zip (Size: 810 bytes / Downloads: 237)
Reply
#2
Hello!

I tried to deal with OLED and digital inputs. Separately the OLED code and the inputs code work correctly. When I was trying to put the code at the same skecth it hasn't been worked properly.

Code:
#define U8x8_DO_NOT_SET_WIRE_CLOCK

#include <U8g2lib.h>
#include <Wire.h>


U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0,  15, 4, U8X8_PIN_NONE);//SCL IO15  SDA  IO4
...
void setup()
{
 
  // init IIC
  Wire.begin(I2C_SDA, I2C_SCL); //If this line was commented the screen would work properly but the inputs wouldn't.
...

  u8g2.setI2CAddress(0x3C*2);
  u8g2.begin();
  u8g2.enableUTF8Print();
 
}

As far as I could understand the issue is related to the I2C bus and the u8g2lib.  I found that the Wire.begin() and u8g2.begin() use SetClock. The SetClock issue resolved at the 2.33 version of the u8g2 library by U8x8_DO_NOT_SET_WIRE_CLOCK definition. In my case the definition has no effect.

Please let me know what the way to use u8g2 library as wrotten at the thread beginning with the Wire object at the same time.
Reply
#3
sorry, i don't know this question, maybe can check on Google.
Reply
#4
SSD1306 and (relay) PCF8574 have not use same IIC address, so SSD1306 and relay can work simultaneously. we have already use KC868-A6 with tasmota firmware for ssd1306 and relay ON/OFF. so hardware is OK, now just software problem, sorry, i don't know the u8g2 library details. maybe you not need to use it or change to use another ssd1306 library.
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)