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: 352)
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
#5
Buen dia como puedo implementar esto para que cuando precione una entrada me indique en el display que salida preciono , no logro hacerlo




[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());

}
Reply
#6
sorry, i don't understand your means.
Reply
#7
(09-15-2024, 11:26 AM)admin Wrote: sorry, i don't understand your means.

buen dia yo encontre la solucion y use mejor esta configuracion y la libreria  SSD1306Wire

#include "SSD1306Wire.h" // legacy include: `#include "SSD1306.h"
// Initialize the OLED display using Wire library
SSD1306Wire display(0x3c, 4, 15);  // ADDRESS, SDA, SCL  -  SDA and SCL 

la otra da muchos problemas
Reply
#8
work well now?
Reply
#9
Si funciona
Reply
#10
Can confirm the problem, u8g2 oled and pcf8574 digital inputs do not work when using them both together.

Finally this lib solved the problem: arduino-cli lib install --git-url https://github.com/ThingPulse/esp8266-oled-ssd1306
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)