I2C with arduino and Display

jarda195
Posts: 5
Joined: Sun Jul 24, 2016 10:01 pm

I2C with arduino and Display

Postby jarda195 » Sun Jul 24, 2016 10:19 pm

Hi

I want to controll arduino with ESP8266 and Espressif using I2C. Will anybody please provide a sample program and steps.I have a Mono Display OLED 128x64... 1,3"

WiFi is ESP wroom 02
etc. Hello world..

Thanks
Last edited by jarda195 on Mon Jul 25, 2016 5:22 am, edited 1 time in total.

User avatar
rudi
Posts: 197
Joined: Fri Oct 24, 2014 7:55 pm

Re: I2C with arduino and Display

Postby rudi » Mon Jul 25, 2016 5:22 am

jarda195 wrote:Hi

I want to controll arduino with ESP8266 and Espressif using I2C. Will anybody please provide a sample program and steps. Display OLED 128x64... 1,3"

WiFi is ESP wroom 02
Test etc. Hello world..

Thanks


ESP WROOM-02 as I2C Master
Arduino as I2C Slave ( for communication with ESP )
right?
where is the OLED connected ( ESP or Arduino ) and how ( SPI, HSPI, I2C ) ?
because Oled is then Slave,
if you connect to Arduino, you must setup Arduino as I2C Slave and I2C Master.


If you mean:
ESP send "Hello World" to the Arduino by I2C protocoll
and Arduino display the Message then to the Oled?

which arduino you use?
5V ( 2560 R3 )
3.3 V ( pro mini )

That is important, because ESP is only 3.3 v pin compatible
so if you use Atmega 2560 R3 with 5 V, you need level shifter.
But You can connect SDA, SCL pulled up to 3.3 v too.
It is how you have build your hardware setup.

Do you use breadboards and wire?
How is your Hardware build and connected?

ESP
you need driver for I2C Master
setup the pins for i2c_master
init the i2c_master

example
you create your protokoll like this:
ESP send first the address byte , Arduino is listen at this address by I2C, you must setup ESP and Arduino to the same Address
example: 0x54
uint8t arduinoaddr = 0x54

ESP send then a command byte, example you setup more commands on Arduino, so setup a command for the arduino that display text what esp is send ,
example: Ox50
uint8t cmdDisplayText = 0x50

Tell Arduino then if you use the command for display text, how many bytes you then send,
you do not need this, but this helps you to understand the protocoll better, you can expand like you want
with this or without this command, i would suggest you, use this..
"Hello World!"
12 Bytes
example : 0x12
(uint8t *) txtlen=strlen("Hello World!")

start your i2c condition
i2c_start();
check buss for free
send address byte with command for write(0) or for read(1) to the arduino
i2c_master_txByte(arduinoaddr + 0)
if arduino ack ( address match )
ACK = i2c_master_get_ack();
send your command for display text to the oled, example 0x50
i2c_master_txByte(cmdDisplayText)
now arduino knows, that it must display the next to oled
that you must setup then in your arduino code so. you can use your own cmd bytes..
because you write the code for arduino too, arduino knows, that now comes the
len of message.
tell arduino how many byte are comes now
i2c_master_txByte(txtlen)
now arduino knows, it come 12 bytes
( here now simple, you can use a loop and buff for the text, but for the example we do here simplest )
send "hello world" to the arduino
i2c_master_txByte("H");
i2c_master_txByte("e");
i2c_master_txByte("l");
i2c_master_txByte("l");
i2c_master_txByte("o");
i2c_master_txByte(" ");
i2c_master_txByte("w");
i2c_master_txByte("o");
i2c_master_txByte("r");
i2c_master_txByte("l");
i2c_master_txByte("d");
i2c_master_txByte("!");

now stop the condition
i2c_master_stop,
you have it done from master to slave.



now the arduino
setup the arduino as slave and the adress 0x54
setup the arduino as master for the oled.
setup your arduino for the oled
init the oled
init the master
init the slave

now listen on i2c
if i2c data match to the slave address
read in the cmd byte
if cmd byte is for textdisplay ( you know, if 0x50 then display OLED and you know, next byte is how many bytes comes )
read in the len of the i2c message ( 0x12 )
( malloc ) a new buff variable for the 12 bytes
now read in the 12 bytes by i2c
after done ( the master send the stop condition ) and you can check it in arduino
arduino knows, the data transfer is end.

arduino send buff to the oled my arduino i2c_master
so check it out
which address oled have
what cmd you need for setup the oled
what cmd you need for you oled to display text.
do make free the buff after send the text to the oled

you have done
hello world!

3 things:
- never connect more as 3.3 v at esp sda from atmega is 5 v, so you need level shifter or connect the sda with pulled up to 3.3 v,
same with clk.
- do not more as read byte in the data transmission, after this you can do work with this or send it to an circular buffer
- design a nice clear protokoll for the esp and arduino, how you want to transmission the data and bytes, so you are flexible
to do more, example cmd 0x20 for get the pin status on arduino and display it on Oled and so on
simple send then after address match, the command byte 0x20 and stop , arduino knows then, pin status request was here and arduino check the pins and display it at Oled.

ok?..


best wishes
rudi ;-)

-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi
Posts: 197
Joined: Fri Oct 24, 2014 7:55 pm

Re: I2C with arduino and Display

Postby rudi » Mon Jul 25, 2016 5:35 am

append..
in the example with arduino and oled and esp,
you connect then sda, scl to each, so be sure, you use then a level shifter between a 5 v arduino and the oled( 3.3 v ) and the esp ( 3.3v)
i think there are 5v compatible oleds too on market, so check moretimes, what components you use. you can do a pullup to 3.3 v ,
but if the oled need 5 v, then you must use level shifter for it or you use a second i2c line,
you can example do a bitbang on other pins ( arduino ) for the oled doings too.
it is - how you want setup your hardware, there are more possible ways.

best wishes
rudi ;-)

-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

jarda195
Posts: 5
Joined: Sun Jul 24, 2016 10:01 pm

Re: I2C with arduino and Display

Postby jarda195 » Mon Jul 25, 2016 5:41 am

Hi

Thank for answer..

So
ESP WROOM-02 as I2C Master (GPIO 14,2)
and
Display is slave..

Arduino is IDE for developer..

All 3.3V

Jarek

User avatar
rudi
Posts: 197
Joined: Fri Oct 24, 2014 7:55 pm

Re: I2C with arduino and Display

Postby rudi » Mon Jul 25, 2016 7:51 am

jarda195 wrote:Hi

Thank for answer..

So
ESP WROOM-02 as I2C Master (GPIO 14,2)
and
Display is slave..

Arduino is IDE for developer..

All 3.3V

Jarek


hi jarek
ah, i think i have you missunderstand.

you develop with the Arduino IDE for ESP8266
and want code for the WROOM-02 that display a Text on Oled, right?

do you know, which Oled you have, SSD1306 ..SSD1351.. ( which address the Oled have )


an example,
look here for more infos

Code: Select all


// Example sketch for testing OLED display

// We need to include Wire.h for I2C communication
#include <Wire.h>
#include "OLED.h"

// Declare OLED display
// display(SDA, SCL);
// SDA and SCL are the GPIO pins of ESP8266 that are connected to respective pins of display.
OLED display(4, 5);

void setup() {
  Serial.begin(9600);
  Serial.println("OLED test!");

  // Initialize display
  display.begin();

  // Test message
  display.print("Hello World");
  delay(3*1000);

  // Test long message
  display.print("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");
  delay(3*1000);

  // Test display clear
  display.clear();
  delay(3*1000);

  // Test message postioning
  display.print("TOP-LEFT");
  display.print("4th row", 4);
  display.print("RIGHT-BOTTOM", 7, 4);
  delay(3*1000);

  // Test display OFF
  display.off();
  display.print("3rd row", 3, 8);
  delay(3*1000);

  // Test display ON
  display.on();
  delay(3*1000);
}

int r = 0, c = 0;

void loop() {
  r = r % 8;
  c = micros() % 6;

  if (r == 0)
    display.clear();

  display.print("Hello World", r++, c++);

  delay(500);
}




look at this example how the guy setup the oled and put messages to the oled:
ssd1306 example
taken from here



Code: Select all


/*
Version 1.0 supports OLED display's with either SDD1306 or with SH1106 controller
*/

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <Wire.h>
#include "font.h"
#define OLED_address  0x3c                           // all the OLED's I have seen have this address
#define SSID "........"                              // insert your SSID
#define PASS "........"                              // insert your password
// ******************* String form to sent to the client-browser ************************************
String form =
  "<p>"
  "<center>"
  "<h1>ESP8266 Web Server</h1>"
  "<form action='msg'><p>Wassup? <input type='text' name='msg' size=50 autofocus> <input type='submit' value='Submit'></form>"
  "</center>";

ESP8266WebServer server(80);                             // HTTP server will listen at port 80
 long period;

/*
  handles the messages coming from the webbrowser, restores a few special characters and
  constructs the strings that can be sent to the oled display
*/
void handle_msg() {
  clear_display();                        // clears oled
 
  server.send(200, "text/html", form);    // Send same page so they can send another msg

  // Display msg on Oled
  String msg = server.arg("msg");
  Serial.println(msg);
  String decodedMsg = msg;
  // Restore special characters that are misformed to %char by the client browser
  decodedMsg.replace("+", " ");     
  decodedMsg.replace("%21", "!"); 
  decodedMsg.replace("%22", ""); 
  decodedMsg.replace("%23", "#");
  decodedMsg.replace("%24", "$");
  decodedMsg.replace("%25", "%"); 
  decodedMsg.replace("%26", "&");
  decodedMsg.replace("%27", "'"); 
  decodedMsg.replace("%28", "(");
  decodedMsg.replace("%29", ")");
  decodedMsg.replace("%2A", "*");
  decodedMsg.replace("%2B", "+"); 
  decodedMsg.replace("%2C", ","); 
  decodedMsg.replace("%2F", "/");   
  decodedMsg.replace("%3A", ":");   
  decodedMsg.replace("%3B", ";"); 
  decodedMsg.replace("%3C", "<"); 
  decodedMsg.replace("%3D", "="); 
  decodedMsg.replace("%3E", ">");
  decodedMsg.replace("%3F", "?"); 
  decodedMsg.replace("%40", "@");
  //Serial.println(decodedMsg);                   // print original string to monitor
  unsigned int lengte = decodedMsg.length();      // length of received message
  for  (int i=0;i<lengte;i++)                     // prints up to 8 rows of 16 characters.
    {
      char c = decodedMsg[i];
      Serial.print(c); //decodedMsg[i]);
           if (i<16)  {sendCharXY(c,0,i);}
      else if (i<32)  {sendCharXY(c,1,i-16);}
      else if (i<48)  {sendCharXY(c,2,i-32);}
      else if (i<64)  {sendCharXY(c,3,i-48);}
      else if (i<80)  {sendCharXY(c,4,i-64);}
      else if (i<96)  {sendCharXY(c,5,i-80);}
      else if (i<112) {sendCharXY(c,6,i-96);}
      else if (i<128) {sendCharXY(c,7,i-112);}

    }
  //Serial.println(' ');                          // new line in monitor
}

void setup(void) {
//ESP.wdtDisable();                               // used to debug, disable wachdog timer,
  Serial.begin(115200);                           // full speed to monitor
  Wire.begin(0,2);                                // Initialize I2C and OLED Display
  init_OLED();                                    //
  reset_display();
  WiFi.begin(SSID, PASS);                         // Connect to WiFi network
  while (WiFi.status() != WL_CONNECTED) {         // Wait for connection
    delay(500);
    Serial.print(".");
  }
  // Set up the endpoints for HTTP server,  Endpoints can be written as inline functions:
  server.on("/", []() {
    server.send(200, "text/html", form);
  });
  server.on("/msg", handle_msg);                  // And as regular external functions:
  server.begin();                                 // Start the server
  clear_display();

  Serial.print("SSID : ");                        // prints SSID in monitor
  Serial.println(SSID);                           // to monitor             
  sendStrXY("SSID :" ,0,0);  sendStrXY(SSID,0,7); // prints SSID on OLED
 
  char result[16];
  sprintf(result, "%3d.%3d.%3d.%3d", WiFi.localIP()[0], WiFi.localIP()[1], WiFi.localIP()[2], WiFi.localIP()[3]);
  Serial.println();Serial.println(result);
  sendStrXY(result,2,0);

  Serial.println("WebServer ready!   ");
  sendStrXY("WebServer ready!",4,0);              // OLED first message
  Serial.println(WiFi.localIP());                 // Serial monitor prints localIP
  Serial.print(analogRead(A0));
  int test = 13;
  pinMode(test,OUTPUT);
  digitalWrite(test,HIGH);
  delay(1000);
  digitalWrite(test,LOW);
}


void loop(void) {
  server.handleClient();                        // checks for incoming messages
}

//==========================================================//
// Resets display depending on the actual mode.
static void reset_display(void)
{
  displayOff();
  clear_display();
  displayOn();
}

//==========================================================//
// Turns display on.
void displayOn(void)
{
  sendcommand(0xaf);        //display on
}

//==========================================================//
// Turns display off.
void displayOff(void)
{
  sendcommand(0xae);      //display off
}

//==========================================================//
// Clears the display by sendind 0 to all the screen map.
static void clear_display(void)
{
  unsigned char i,k;
  for(k=0;k<8;k++)
  {   
    setXY(k,0);   
    {
      for(i=0;i<(128 + 2 * offset);i++)     //locate all COL
      {
        SendChar(0);         //clear all COL
        //delay(10);
      }
    }
  }
}

//==========================================================//
// Actually this sends a byte, not a char to draw in the display.
// Display's chars uses 8 byte font the small ones and 96 bytes
// for the big number font.
static void SendChar(unsigned char data)
{
  //if (interrupt && !doing_menu) return;   // Stop printing only if interrupt is call but not in button functions
 
  Wire.beginTransmission(OLED_address); // begin transmitting
  Wire.write(0x40);//data mode
  Wire.write(data);
  Wire.endTransmission();    // stop transmitting
}

//==========================================================//
// Prints a display char (not just a byte) in coordinates X Y,
// being multiples of 8. This means we have 16 COLS (0-15)
// and 8 ROWS (0-7).
static void sendCharXY(unsigned char data, int X, int Y)
{
  setXY(X, Y);
  Wire.beginTransmission(OLED_address); // begin transmitting
  Wire.write(0x40);//data mode
 
  for(int i=0;i<8;i++)         
    Wire.write(pgm_read_byte(myFont[data-0x20]+i));
   
  Wire.endTransmission();    // stop transmitting
}

//==========================================================//
// Used to send commands to the display.
static void sendcommand(unsigned char com)
{
  Wire.beginTransmission(OLED_address);     //begin transmitting
  Wire.write(0x80);                          //command mode
  Wire.write(com);
  Wire.endTransmission();                    // stop transmitting
}

//==========================================================//
// Set the cursor position in a 16 COL * 8 ROW map.
static void setXY(unsigned char row,unsigned char col)
{
  sendcommand(0xb0+row);                //set page address
  sendcommand(offset+(8*col&0x0f));       //set low col address
  sendcommand(0x10+((8*col>>4)&0x0f));  //set high col address
}


//==========================================================//
// Prints a string regardless the cursor position.
static void sendStr(unsigned char *string)
{
  unsigned char i=0;
  while(*string)
  {
    for(i=0;i<8;i++)
    {
      SendChar(pgm_read_byte(myFont[*string-0x20]+i));
    }
    *string++;
  }
}

//==========================================================//
// Prints a string in coordinates X Y, being multiples of 8.
// This means we have 16 COLS (0-15) and 8 ROWS (0-7).
static void sendStrXY( char *string, int X, int Y)
{
  setXY(X,Y);
  unsigned char i=0;
  while(*string)
  {
    for(i=0;i<8;i++)
    {
      SendChar(pgm_read_byte(myFont[*string-0x20]+i));
    }
    *string++;
  }
}


//==========================================================//
// Inits oled and draws logo at startup
static void init_OLED(void)
{
  sendcommand(0xae);      //display off
  sendcommand(0xa6);            //Set Normal Display (default)
    // Adafruit Init sequence for 128x64 OLED module
    sendcommand(0xAE);             //DISPLAYOFF
    sendcommand(0xD5);            //SETDISPLAYCLOCKDIV
    sendcommand(0x80);            // the suggested ratio 0x80
    sendcommand(0xA8);            //SSD1306_SETMULTIPLEX
    sendcommand(0x3F);
    sendcommand(0xD3);            //SETDISPLAYOFFSET
    sendcommand(0x0);             //no offset
    sendcommand(0x40 | 0x0);      //SETSTARTLINE
    sendcommand(0x8D);            //CHARGEPUMP
    sendcommand(0x14);
    sendcommand(0x20);             //MEMORYMODE
    sendcommand(0x00);             //0x0 act like ks0108
   
    //sendcommand(0xA0 | 0x1);      //SEGREMAP   //Rotate screen 180 deg
    sendcommand(0xA0);
   
    //sendcommand(0xC8);            //COMSCANDEC  Rotate screen 180 Deg
    sendcommand(0xC0);
   
    sendcommand(0xDA);            //0xDA
    sendcommand(0x12);           //COMSCANDEC
    sendcommand(0x81);           //SETCONTRAS
    sendcommand(0xCF);           //
    sendcommand(0xd9);          //SETPRECHARGE
    sendcommand(0xF1);
    sendcommand(0xDB);        //SETVCOMDETECT               
    sendcommand(0x40);
    sendcommand(0xA4);        //DISPLAYALLON_RESUME       
    sendcommand(0xA6);        //NORMALDISPLAY             

  clear_display();
  sendcommand(0x2e);            // stop scroll
  //----------------------------REVERSE comments----------------------------//
    sendcommand(0xa0);      //seg re-map 0->127(default)
    sendcommand(0xa1);      //seg re-map 127->0
    sendcommand(0xc8);
    delay(1000);
  //----------------------------REVERSE comments----------------------------//
  // sendcommand(0xa7);  //Set Inverse Display 
  // sendcommand(0xae);      //display off
  sendcommand(0x20);            //Set Memory Addressing Mode
  sendcommand(0x00);            //Set Memory Addressing Mode ab Horizontal addressing mode
  //  sendcommand(0x02);         // Set Memory Addressing Mode ab Page addressing mode(RESET) 
}






there are many examples on the net,


if you see in your Arduino IDE you find examples for OLED too.
hope this helps?

best wishes
rudi ;-)

-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

jarda195
Posts: 5
Joined: Sun Jul 24, 2016 10:01 pm

Re: I2C with arduino and Display

Postby jarda195 » Mon Jul 25, 2016 1:00 pm

Hi

Very thanks..

Yes.. I develop with the Arduino IDE for ESP8266.. :)

I have OLED1306

Jarek

jarda195
Posts: 5
Joined: Sun Jul 24, 2016 10:01 pm

Re: I2C with arduino and Display

Postby jarda195 » Mon Jul 25, 2016 2:55 pm

Hi

After the start I got this error message.

Where is my mistake?

Pins on ESP WROOM 02 is IO14-SCL and IO2-SDA... ok ? see image

Jarek



DisplayOLED:11: error: no matching function for call to 'OLED::OLED(int, int)'

OLED display(4, 5);

^

C:\Users\jvyslouzil\Documents\Arduino\Dispay OLED\DisplayOLED\DisplayOLED.ino:11:18: note: candidates are:

.....\Arduino\Dispay OLED\DisplayOLED\DisplayOLED.ino:6:0:

sketch\OLED.h:64:5: note: OLED::OLED(uint8_t, uint8_t, uint8_t, uint8_t)

OLED(uint8_t pinPower, uint8_t pinReset, uint8_t baudRate, uint8_t startUpTimer);

^

sketch\OLED.h:64:5: note: candidate expects 4 arguments, 2 provided

sketch\OLED.h:60:7: note: constexpr OLED::OLED(const OLED&)

class OLED

^

sketch\OLED.h:60:7: note: candidate expects 1 argument, 2 provided

sketch\OLED.h:60:7: note: constexpr OLED::OLED(OLED&&)

sketch\OLED.h:60:7: note: candidate expects 1 argument, 2 provided

......\Arduino\Dispay OLED\DisplayOLED\DisplayOLED.ino: In function 'void setup()':

DisplayOLED:18: error: 'class OLED' has no member named 'begin'

display.begin();

^

DisplayOLED:21: error: 'class OLED' has no member named 'print'

display.print("Hello World");

^

DisplayOLED:25: error: 'class OLED' has no member named 'print'

display.print("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.");

^

DisplayOLED:29: error: 'class OLED' has no member named 'clear'

display.clear();

^

DisplayOLED:33: error: 'class OLED' has no member named 'print'

display.print("TOP-LEFT");

^

DisplayOLED:34: error: 'class OLED' has no member named 'print'

display.print("4th row", 4);

^

DisplayOLED:35: error: 'class OLED' has no member named 'print'

display.print("RIGHT-BOTTOM", 7, 4);

^

DisplayOLED:39: error: 'class OLED' has no member named 'off'

display.off();

^

DisplayOLED:40: error: 'class OLED' has no member named 'print'

display.print("3rd row", 3, 8);

^

DisplayOLED:44: error: 'class OLED' has no member named 'on'

display.on();

^

.....\Arduino\Dispay OLED\DisplayOLED\DisplayOLED.ino: In function 'void loop()':

DisplayOLED:55: error: 'class OLED' has no member named 'clear'

display.clear();

^

DisplayOLED:57: error: 'class OLED' has no member named 'print'

display.print("Hello World", r++, c++);

^

exit status 1
no matching function for call to 'OLED::OLED(int, int)'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.




==========================================================================
oled.h


/*
Oled.h - Oled Display library for Arduino & 4d Systems Serial OLEDs
Copyright(c) 2010 Paul Karlik
Original Source Copyright(c)2007 Oscar Gonzalez

Licensed under the MIT license:
http://www.opensource.org/licenses/mit-license.php

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

16bitColor from RGB by YAPAN.org's small utilities for Arduino
http://www.opensource.org/licenses/bsd-license.php
*/

#ifndef Oled_h
#define Oled_h

#include <inttypes.h>

#define OLED_BAUDRATE 57600
#define OLED_RESETPIN 8
#define OLED_INITDELAYMS 1000

#define OLED_DETECT_BAUDRATE 0x55

#define OLED_CLEAR 0x45
#define OLED_BKGCOLOR 0x42
#define OLED_COPYPASTE 0x63

#define OLED_SAVE_CHAR 0x41
#define OLED_DISPLAY_CHAR 0x44

#define OLED_LINE 0x4C
#define OLED_CIRCLE 0x43
#define OLED_CIRCLEFILL 0x69
#define OLED_PUTPIXEL 0x50
#define OLED_READPIXEL 0x52
#define OLED_RECTANGLE 0x72
#define OLED_SETPEN 0x70
#define OLED_SETFONTSIZE 0x46
#define OLED_FONT5X7 0x01
#define OLED_FONT8X8 0x02
#define OLED_FONT8X12 0x03
#define OLED_TEXTFORMATED 0x54

#define OLED_COMMAND_CONTROL 0x59
#define OLED_COMMAND_DISPLAY 0x01
#define OLED_COMMAND_CONTRAST 0x02
#define OLED_COMMAND_POWER 0x03

#define OLED_ACK 0x06
#define OLED_NAK 0x15

class OLED
{

public:
OLED(uint8_t pinPower, uint8_t pinReset, uint8_t baudRate, uint8_t startUpTimer);

uint8_t Init();
unsigned int get16bitRGB(uint8_t red, uint8_t green, uint8_t blue);


uint8_t ResetDisplay();
uint8_t Clear();
uint8_t PutPixel(uint8_t x, uint8_t y, unsigned int color);
uint8_t PenSize(uint8_t size);
uint8_t DrawLine(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, unsigned int color);
uint8_t DrawRectangle(uint8_t x, uint8_t y, uint8_t width, uint8_t height, unsigned int color);
uint8_t DrawCircle(uint8_t x, uint8_t y, uint8_t radius, unsigned int color);
uint8_t SetFontSize(uint8_t FontType);
uint8_t DrawText(uint8_t column, uint8_t row, uint8_t font_size, char *mytext, unsigned int color);
uint8_t DrawSingleChar(uint8_t column, uint8_t row, uint8_t font_size, uint8_t MyChar, unsigned int color);
uint8_t CopyPast(uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t width, uint8_t height);
uint8_t SaveBitChar(uint8_t slot, uint8_t data1, uint8_t data2, uint8_t data3, uint8_t data4, uint8_t data5, uint8_t data6, uint8_t data7, uint8_t data8);
uint8_t DisplayBitChar(uint8_t slot, uint8_t x, uint8_t y, unsigned int color);

private:
uint8_t _pinReset;
uint8_t _pinPower;
uint8_t _baudRate;
uint8_t _startUpTimer;

void write(uint8_t value);

};

#endif
Attachments
Untitled-14.png

User avatar
rudi
Posts: 197
Joined: Fri Oct 24, 2014 7:55 pm

Re: I2C with arduino and Display

Postby rudi » Mon Jul 25, 2016 4:45 pm

jarda195 wrote:Hi

After the start I got this error message.

Where is my mistake?

Pins on ESP WROOM 02 is IO14-SCL and IO2-SDA... ok ? see image

Jarek



DisplayOLED:11: error: no matching function for call to 'OLED::OLED(int, int)'

OLED display(4, 5);

^


have you rename the folder ?

Code: Select all

    Click on the Download ZIP button in the top right corner.
    Uncompress it.
    Rename the uncompressed folder to OLED.
    Check that the OLED folder contains OLED.cpp and OLED.h files.
    Place the OLED folder in your <arduinosketchfolder>/libraries/ folder
              - you may need to create the libraries subfolder if it is your first     library.
    Restart the IDE.



have you setup your OLED on right pins?

Code: Select all

..
// Declare OLED display
// display(SDA, SCL);
// SDA and SCL are the GPIO pins of ESP8266 that are connected to respective pins of display.
OLED display(2, 14);
..


have you read the link i posted?

please read the reference project ( click me - i am a link )


best wishes
rudi ;-)

-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

User avatar
rudi
Posts: 197
Joined: Fri Oct 24, 2014 7:55 pm

Re: I2C with arduino and Display

Postby rudi » Mon Jul 25, 2016 4:46 pm

look in the example folder too, there is an example

-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

jarda195
Posts: 5
Joined: Sun Jul 24, 2016 10:01 pm

Re: I2C with arduino and Display

Postby jarda195 » Mon Jul 25, 2016 5:45 pm

Hi

Thanks.. Super..

I using Ctrl-C and Ctrl-V only..
and new appl on ArduinoIDE...

thanks

Jarek

Who is online

Users browsing this forum: No registered users and 1 guest