Alexis Santiago Allende
Published © GPL3+

Oled Display with Arduino 101

After many failed attempts, find the way to connect my 128X64 screen with my Arduino 101, and make a mini tutorial for all users to use.

BeginnerFull instructions provided1 hour17,999
Oled Display with Arduino 101

Things used in this project

Hardware components

Arduino 101
Arduino 101
×1
OLED 128X64
×1
Rotary potentiometer (generic)
Rotary potentiometer (generic)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
USB-A to B Cable
USB-A to B Cable
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

My circuit

Code

Code

Arduino
Code to send information to the OLED display
#include <Arduino.h>
#include <U8g2lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
#ifdef U8X8_HAVE_HW_I2C
#include <Wire.h>
#endif

U8G2_SSD1306_128X64_NONAME_F_SW_I2C u8g2(U8G2_R0, /* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);   // All Boards without Reset of the Display


int a=0; //variable of value of analog read pin
char taco[4];//variable to send text to the oled display
void setup(void) {
  u8g2.begin();// Oled display begins
}

void loop(void) {
  a=analogRead(A0); //read potentiometer value
  sprintf(taco,"%04d",a); //convert potentiometer value to string
  u8g2.clearBuffer();					// clear the internal memory
  u8g2.setFont(u8g2_font_inr38_mf);	// choose a suitable font
  u8g2.drawStr(0,60,taco);  // write something to the internal memory
  u8g2.sendBuffer();					// transfer internal memory to the display
  delay(1000);  
}

Credits

Alexis Santiago Allende

Alexis Santiago Allende

0 projects • 73 followers
Im a person who since young feel a passion for electronics, I also like to cook pizza and travel. Now Im working on the internet of things

Comments