Closed fcwpinguino closed 9 years ago
Hi Fred, Is this one of the examples provided ? I can't find it ...
Regis Marcus had this on his web page using it with a pinguino 4550
Ok, I think I've found it here : http://www.fazzi.eng.br/2010/12/pinguino-i2c-oled-display.html The code is a bit old and since we made an Oled library ... Which display do you have ? SSD1306 ? If so, connect your display to the i2c pins of your board. Tell the IDE you want to use the i2c interface :
and init the display with : SSD1306.init(i2c_addr_of_your_display);
See also 07.Display/SSD1306/HelloWorld.pde
Regis I will try this tonight whe. I get home Thank you Fred
Regis,
i have the SSD1308
Fred
-----Original Message----- From: regis notifications@github.com To: PinguinoIDE/pinguino-libraries pinguino-libraries@noreply.github.com Cc: Fred Warden fcw158@aol.com Sent: Mon, Mar 9, 2015 6:16 am Subject: Re: [pinguino-libraries] OLED (#7)
Ok, I think I've found it here : http://www.fazzi.eng.br/2010/12/pinguino-i2c-oled-display.html The code is a bit old and since we made an Oled library ... Which display do you have ? SSD1306 ? If so, connect your display to the i2c pins of your board. Tell the IDE you want to use the i2c interface :
and init the display with : SSD1306.init(i2c_addr_of_your_display);
See also 07.Display/SSD1306/HelloWorld.pde
— Reply to this email directly or view it on GitHub.
Hi Fred, May I close this issue ?
Regis Yes
Sent from my iPhone
On Apr 9, 2015, at 4:26 AM, regis notifications@github.com wrote:
Hi Fred, May I close this issue ?
— Reply to this email directly or view it on GitHub.
REGIS, i know this is not in the library , but i found this from Marcus Fazzi and tried bit received an error
// Program for I2C communication with a 128x64 OLED Display (http://www.seeedstudio.com) // Marcus Fazzi 2010
define LED 13
define I2C_address 0x3c // i2c address of Display
include
//For working with strings strlen() function // #include
include
unsigned char fill_OLED = 0x55; unsigned char fill_string1[13]="Pinguino OLED"; unsigned char fill_string2[11]="OLED 128x64"; unsigned char fill_string3[16]="0123456789ABCDEF"; unsigned char fill_string4[2]="SS";
//======================= void sendcommand(unsigned char com) {
short dt[2] = { 0x80, com }; //command mode I2C_write(I2C_address, dt, 2); I2C_STOP(); //stop transmitting }
//=================================== void SendChar(unsigned char dat) { short dt[2] = { 0x40, dat }; //data mode I2C_write(I2C_address, dt, 2); I2C_STOP(); //stop transmitting }
//=================================== void setXY(unsigned char row,unsigned char col) { sendcommand(0xb0 + row); //set page address sendcommand(0x00 + (8 * col & 0x0f)); //set low col address sendcommand(0x10 + ((8 * col >> 4) & 0x0f)); //set high col address }
//================================== void clear_display() { unsigned char i,k; for(k=0;k<8;k++) { setXY(k,0);
{ for(i=0;i<128;i++) //clear all COL { SendChar(0); } } } }
//================================== void printChar(unsigned char ascii) { unsigned char i; for(i=0;i<8;i++) { SendChar(myFont[ascii-0x20][i]); } }
//================================== void sendStr(unsigned char _string, unsigned char len) { unsigned char i, j; //setXY(0,0);
for(i=0;i<len;i++) { for(j=0;j<8;j++) { SendChar(myFont[string-0x20][j]); //SendChar(_string); delay(10); } string++; } }
//================================= void init_OLED(void) { sendcommand(0xae); //display off delay(50); // sendcommand(0xa0); //seg re-map 0->127(default) // sendcommand(0xa1); //seg re-map 127->0 // sendcommand(0xc8); // delay(1000); sendcommand(0xaf); //display on delay(50); }
void setup() { delay(500); init_I2C(); //SSPADD=19; //Slow mode
init_OLED(); delay(10); clear_display(); delay(50);
pinMode(LED, OUTPUT);
}
//======================== void loop() { short i;
clear_display(); delay(50);
sendcommand(0x20); //Set Memory Addressing Mode sendcommand(0x02); //Set Memory Addressing Mode ab Page addressing mode(RESET)
sendcommand(0xa6); //Set Normal Display (default) setXY(3,2); sendStr(fill_string1, 13); setXY(4,3); sendStr(fill_string2, 11);
delay(2000); sendcommand(0xa7); //Set Inverse Display
delay(2000);
clear_display(); delay(50);
setXY(0,0); sendcommand(0xa6); //Set Normal Display
sendcommand(0xae); //display off sendcommand(0x20); //Set Memory Addressing Mode sendcommand(0x00); //Set Memory Addressing Mode ab Horizontal addressing mode
for(i=0;i<128*8;i++) //write a 128x64 picture { SendChar(logo[i]); }
sendcommand(0xaf); //display on delay(2000); sendcommand(0xa7); //Set Inverse Display delay(2000);
while(1) { //sendcommand(0xa6); Set Normal Display sendcommand(0x29); //Vertical and Horizontal Scroll Setup sendcommand(0x00); //dummy byte sendcommand(0x00); //define page0 as startpage address sendcommand(0x00); //set time interval between each scroll ste as 6 frames sendcommand(0x07); //define page7 as endpage address sendcommand(0x01); //set vertical scrolling offset as 1 row sendcommand(0x2f); //active scrolling delay(3000); };
} OUT] ERROR: 5: No such file or directory
define I2C_address 0x3c
define.c
define I2C_address 0x3c
define LED 13
include
include
include
include
include
user.c
unsigned char fill_OLED = 0x55; unsigned char fill_string1[13]="Pinguino OLED"; unsigned char fill_string2[11]="OLED 128x64"; unsigned char fill_string3[16]="0123456789ABCDEF"; unsigned char fill_string4[2]="SS";
void sendcommand(unsigned char com) {
short dt[2] = { 0x80, com }; I2C_write(I2C_address, dt, 2); I2C_STOP(); }
void SendChar(unsigned char dat) { short dt[2] = { 0x40, dat }; I2C_write(I2C_address, dt, 2); I2C_STOP();
}
void setXY(unsigned char row,unsigned char col) { sendcommand(0xb0 + row); sendcommand(0x00 + (8 * col & 0x0f)); sendcommand(0x10 + ((8 * col >> 4) & 0x0f)); }
void clear_display() { unsigned char i,k; for(k=0;k<8;k++) { setXY(k,0);
{ for(i=0;i<128;i++) { SendChar(0); } } } }
void printChar(unsigned char ascii) { unsigned char i; for(i=0;i<8;i++) { SendChar(myFont[ascii-0x20][i]); } }
void sendStr(unsigned char *string, unsigned char len) { unsigned char i, j;
for(i=0;i<len;i++) { for(j=0;j<8;j++) { SendChar(myFont[*string-0x20][j]);
} }
void init_OLED(void) { sendcommand(0xae);
Delayms(50);
sendcommand(0xaf);
Delayms(50); }
void setup() { Delayms(500); init_I2C();
init_OLED(); Delayms(10); clear_display(); Delayms(50);
pinmode(LED, OUTPUT);
}
void loop() { short i;
clear_display(); Delayms(50);
sendcommand(0x20);
sendcommand(0x02);
sendcommand(0xa6);
setXY(3,2); sendStr(fill_string1, 13); setXY(4,3); sendStr(fill_string2, 11);
Delayms(2000); sendcommand(0xa7);
Delayms(2000);
clear_display(); Delayms(50);
setXY(0,0); sendcommand(0xa6);
sendcommand(0xae);
sendcommand(0x20);
sendcommand(0x00);
for(i=0;i<128*8;i++)
{ SendChar(logo[i]); }
sendcommand(0xaf);
Delayms(2000); sendcommand(0xa7);
Delayms(2000);
while(1) {
};
}
thanks fred