Example #1
0
int main(void){
	_delay_ms(1000);

/* Initialize OLED Display */
	init_OLED();
	reset_display();

	while(1){

		/*Draw image on Screen*/
		for(int i=0;i<128*8;i++)     // show 128* 64 Logo
					SendChar(pgm_read_byte(logo2+i));

		sendcommand(0x2f);  /*Scroll on*/
		_delay_ms(4000);
		sendcommand(0x2e);  /*Scroll off*/


		clear_display();

/* Draw text from font */
		sendStrXY("   VISIT US AT  ",0,0);
		sendStrXY("      WWW.      ",2,0);
		sendStrXY(" ELEMENTZONLINE ",4,0);
		sendStrXY("      .COM      ",6,0);

		_delay_ms(8000);
		clear_display();
	}
return 0;
}
Example #2
0
int main () {
  halInit();
  chSysInit();
  
  static const I2CConfig i2cconfig = { I2C_FAST_MODE_PLUS, 2000000 };
  i2cStart(&I2CD1, &i2cconfig);

  init_OLED();
  
  // launch the blinker background thread
  chThdCreateStatic(waBlinkTh, sizeof(waBlinkTh), NORMALPRIO, BlinkTh, NULL);
  
  chThdSleepMilliseconds(1000);
  clearDisplay();
  printBigDigit(1, 0, 0);
  chThdSleepMilliseconds(250);
  printBigDigit(2, 0, 3);
  chThdSleepMilliseconds(250);
  printBigDigit(3, 0, 6);
  chThdSleepMilliseconds(250);
  printBigDigit(4, 0, 9);
  chThdSleepMilliseconds(250);
  printBigDigit(5, 0, 12);
  chThdSleepMilliseconds(250);
  printBigDigit(6, 4, 0);
  chThdSleepMilliseconds(250);
  printBigDigit(7, 4, 3);
  chThdSleepMilliseconds(250);
  printBigDigit(8, 4, 6);
  chThdSleepMilliseconds(250);
  printBigDigit(9, 4, 9);
  chThdSleepMilliseconds(250);
  printBigDigit(0, 4, 12);
  chThdSleepMilliseconds(1000);

  // display some changing text on the display
  static char buf[17];
  for (int y = 0; ; ++y) {
    chThdSleepMilliseconds(500);
    for (int x = 0; x < 16; ++x)
      buf[x] = ' ' + x + y % 80;
    sendStrXY(buf, y % 8, 0);
  }

  return 0;
}
void i2c_oled::init(int i2c_devid=OLED_DEVID)
{
  _devid=i2c_devid; 
  init_OLED();
}
Example #4
0
void OLED::begin(void) {
	// set up i2c
	Wire.begin(_sda, _scl);
	init_OLED();
	reset_display();
}