PaulS:
Post your code HERE.
Post links to non-standard libraries HERE.
Post error messages HERE.
Thank you Paul for the tips. I'd love to post code, if it would help. It is only the stuff I was trying to avoid repeating...
Posting Code HERE. This is oled-example.ino (provided by ChrisO of Newhaven Display Team)
// library by Phil Grant 2013 www.gadjet.co.uk
// OLedI2C library http://gadjetsblog.blogspot.com/2013/09/oled-1602-display-and-library-for.html
// I2C Wire Library Newhaven Display NHD-0420CW OLED TEST
// Wire Library, This library allows you to communicate with I2C / TWI devices
// Board I2C / TWI pins
// Uno, Ethernet A4 (SDA), A5 (SCL)
// Mega2560 20 (SDA), 21 (SCL)
// Leonardo 2 (SDA), 3 (SCL)
// Due 20 (SDA), 21 (SCL), SDA1, SCL1
//Teensy 3.0/3.1 18 (SDA), 19 (SCL),Back Side 30 (SDA1), 29 (SCL1)
#include <Wire.h>
#define I2C_ADDR 0x3c // Define I2C Address, 0x3c or 0x3d
#include <OLedI2C.h>
OLedI2C LCD;
// custom font arrays
byte newChar1[8] = {
B11011,
B11111,
B11111,
B11111,
B11111,
B11111,
B11111,
B10101
};
byte newChar2[8] = {
B10000,
B01000,
B00101,
B00100,
B00100,
B00101,
B01000,
B10000
};
byte newChar3[8] = {
B10001,
B01010,
B01110,
B00100,
B00100,
B01110,
B01010,
B10001
};
byte newChar4[8] = {
B11111,
B11111,
B11111,
B00100,
B00100,
B11111,
B11111,
B11111
};
byte newChar5[8] = { // 5TH custom font
B10101,
B10000,
B10110,
B00001,
B00000,
B10001,
B01010,
B00000
};
void setup() {
Wire.begin(); // Start Wire Library
LCD.init(I2C_ADDR); // initialize the lcd with I2C Address
//delay(1000);
// Store custom font data in 420CW Oled
LCD.createChar(0, newChar1);
LCD.createChar(1, newChar2);
LCD.createChar(2, newChar3);
LCD.createChar(3, newChar4);
LCD.createChar(4, newChar5);
LCD.createChar(5, newChar5);
LCD.createChar(6, newChar5);
LCD.createChar(7, newChar5);
LCD.sendString("SETUP ()", 0, 0); //("String", col, row)
delay(1000);
}
void loop() {
//////////// set Contrast test 1 ////////////////
LCD.sendString("set Contrast test DW", 0, 0); //("String", col, row)
for (int Contrast = 255; Contrast > 0; Contrast = Contrast-- / 2 ) {
LCD.setContrast(Contrast); // Set Contrast (Minimum allowed 0) 0~255
LCD.setCursor(9, 1); //(col,row)
LCD.print(Contrast);
LCD.print(" "); //clear
delay(300); //delay not necessary as its sending a lot of Commands wich has delay inside the lib.
}
delay(2000); // 2sec. delay
LCD.clearLcd();
LCD.sendString("set Contrast test UP", 0, 0); //("String", col, row)
for (int Contrast = 0; Contrast < 510; Contrast = Contrast++ * 2 ) {
LCD.setContrast(Contrast); // Set Contrast (Minimum allowed 0) 0~255
LCD.cursPos(9, 1); //(col,row)
LCD.print(Contrast);
LCD.print(" "); //clear
delay(300); //delay not necessary as its sending a lot of Commands wich has delay inside the lib.
}
delay(2000); // 2sec. delay
LCD.clearLcd();
// Double Height(4-line) Test
LCD.sendString("Double Height(4x20)", 0, 0);
LCD.sendString("Test", 8, 1);
delay(2000); // 2sec. delay
LCD.setDoubleH(1);
LCD.sendString("MODE 1", 0, 2);
delay(1000); // 1sec. delay
LCD.setDoubleH(2);
LCD.sendString("MODE 2", 0, 2);
delay(1000); // 1sec. delay
LCD.setDoubleH(3);
LCD.sendString("MODE 3", 0, 1);
delay(1000); // 1sec. delay
LCD.sendString(" ", 0, 1); // clear MODE 3 from Oled
LCD.setDoubleH(4);
LCD.sendString("MODE 4", 0, 2);
delay(1000); // 1sec. delay
LCD.setDoubleH(0); //back to 4x20
LCD.sendString("MODE 0 (4-line)", 0, 2);
delay(3000); // 3sec. delay
LCD.clearLcd();
//////////// Print custom font Using Wire.h Library test 2 ////////////////
LCD.setDoubleH(3); // MODE 1
LCD.sendString("Print custom font / Wire Library", 0, 0); //("String", col, row)
LCD.sendString("custom font -->", 0, 3);
delay(3000); // 1sec. delay
LCD.setDoubleH(0);
delay(1000); // 1sec. delay
LCD.cursPos(16, 3); //(col,row) / set up position
// Test / Print custom font 5 using Wire.h Library
Wire.beginTransmission(I2C_ADDR); // start condition + Define I2C Address where the US2066 is, and set R/W# bit to logic “0” write mode.
// Print custom font
Wire.write(B01000000); // control byte or the data byte, Co and D/C# bits following by six “0”’s.
//Wire.write(B00000011); //DEC 3 // print custom font 4 [8bit (hi bit 0000/low bit 0011
Wire.write(4); //DEC 4 / 5th custom font (Zero based array indexing.....)
Wire.endTransmission(); // stop condition / 7) The write mode will be finished when a stop condition is applied.
delay(3000); // 3sec. delay
LCD.clearLcd();
delay(1000); //1sec. delay
//////////// Print 2 custom font Using LCD.sendData test 3 ////////////////
LCD.sendString(" Print two custom fonts / LCD.sendData", 0, 0); //("String", col, row)
LCD.cursPos(2, 2); //(col,row)
LCD.print("---> ");
delay(1000); // 1sec. delay
LCD.sendData(0); //Print custom font 1 (Zero based array indexing.....)
LCD.print(" <---> ");
delay(1000); // 1sec. delay
LCD.sendData(char(1)); //Print custom font 2
delay(3000); // 3sec. delay
LCD.clearLcd();
delay(1000);
//LCD.scrollString("test", 2, 100);
//////////// command test ////////////////
/*
sendCommand(0x2A);//function set (extended command set)
sendCommand(0x71); //function selection A
sendData(0x00); //disable internal VDD regulator (2.8V I/O). data(0x5C) = enable regulator (5V I/O)
sendCommand(0x28); //function set (fundamental sendCommand set)
sendCommand(0x08); //display off, cursor off, blink off
sendCommand(0x2A); //function set (extended command set)
sendCommand(0x79); //OLED command set enabled
sendCommand(0xD5); //set display clock divide ratio/oscillator frequency
sendCommand(0x70); //set display clock divide ratio/oscillator frequency
sendCommand(0x78); //OLED command set disabled
sendCommand(0x09); //extended function set (4-lines) / last bit=1 : 3-line or 4-line display mode
sendCommand(0x06); //COM SEG direction
sendCommand(0x72); //function selection B
sendData(B00000000); //ROM CGRAM selection
sendCommand(0x2A); //function set (extended command set)
sendCommand(0x79); //OLED command set enabled
sendCommand(0xDA); //set SEG pins hardware configuration
sendCommand(0x10); //set SEG pins hardware configuration
sendCommand(0xDC); //function selection C
sendCommand(0x00); //function selection C
sendCommand(0x81); //set contrast control
sendCommand(0x7F); //set contrast control
sendCommand(0xD9); //set phase length
sendCommand(0xF1); //set phase length
sendCommand(0xDB); //set VCOMH deselect level
sendCommand(0x40); //set VCOMH deselect level
sendCommand(0x78); //OLED command set disabled
sendCommand(0x28); //function set (fundamental command set)
sendCommand(0x01); //clear display
sendCommand(0x80); //set DDRAM address to 0x00
sendCommand(0x0C); //display ON
delay(150);
sendCommand(0x0C); // **** Turn on Display
delay(150);*/
}
And this is the link to Non-Standard Libraries: http://www.mpr75.talktalk.net/
I'm sure you don't realty mean that I should post the verbose log HERE? - it's 30kb!
I have posted it at the link above.
PaulS:
It appears, though, as though you have linker issues, not compiler issues. This suggests to me that you have the header file for a class, but not the source code that goes with it.
The Library that I was given by Newhaven Displays has two files: OLedI2C.ccp & OLedI2C.h. I guess that the .h is the class header & the .ccp is the class source code that goes with it? Do I need more?
Best regards, Martin