Don't like ads? Help support the Mercs by becoming a Supporter or Auxiliary Member today! (You will need to be logged into the store)
Official Members also get to use the forum ad-free - so kit up and join us!


 electriFi tutorial: build your own OLED display

  • 72 Replies
  • 24202 Views

Zahn Va'roth


    *
  • 288
  • Nu kyr'adyc, shi taab'echaaj'la
Re: electriFi tutorial: build your own OLED display
« Reply #50 on: Oct 01, 2020, 08:26 PM »
I did try that, but the screen remains blank.
It may have something to do with the display command I had to change. I changed it from :
Adafruit_SSD1306 display(8,9);
To
Adafruit_SH1106 display(OLED_RESET);

The example from the 1106 library I found uses that as its display, if I use the (8,9) one, it throws this error.
Arduino: 1.8.13 (Windows 10), Board: "Arduino Nano, ATmega328P"


Targeting___Target:13:28: error: no matching function for call to 'Adafruit_SH1106::Adafruit_SH1106(int, int)'

 Adafruit_SH1106 display(8,9);

                            ^

In file included from D:\Code\Mando OLED\Targeting___Target\Targeting___Target.ino:1:0:

D:\New folder (4)\Arduino\libraries\Adafruit_SH1106-master/Adafruit_SH1106.h:145:3: note: candidate: Adafruit_SH1106::Adafruit_SH1106(int8_t)

   Adafruit_SH1106(int8_t RST);

   ^~~~~~~~~~~~~~~

D:\New folder (4)\Arduino\libraries\Adafruit_SH1106-master/Adafruit_SH1106.h:145:3: note:   candidate expects 1 argument, 2 provided

D:\New folder (4)\Arduino\libraries\Adafruit_SH1106-master/Adafruit_SH1106.h:144:3: note: candidate: Adafruit_SH1106::Adafruit_SH1106(int8_t, int8_t, int8_t)

   Adafruit_SH1106(int8_t DC, int8_t RST, int8_t CS);

   ^~~~~~~~~~~~~~~

D:\New folder (4)\Arduino\libraries\Adafruit_SH1106-master/Adafruit_SH1106.h:144:3: note:   candidate expects 3 arguments, 2 provided

D:\New folder (4)\Arduino\libraries\Adafruit_SH1106-master/Adafruit_SH1106.h:143:3: note: candidate: Adafruit_SH1106::Adafruit_SH1106(int8_t, int8_t, int8_t, int8_t, int8_t)

   Adafruit_SH1106(int8_t SID, int8_t SCLK, int8_t DC, int8_t RST, int8_t CS);

   ^~~~~~~~~~~~~~~

D:\New folder (4)\Arduino\libraries\Adafruit_SH1106-master/Adafruit_SH1106.h:143:3: note:   candidate expects 5 arguments, 2 provided

D:\New folder (4)\Arduino\libraries\Adafruit_SH1106-master/Adafruit_SH1106.h:141:7: note: candidate: constexpr Adafruit_SH1106::Adafruit_SH1106(const Adafruit_SH1106&)

 class Adafruit_SH1106 : public Adafruit_GFX {

       ^~~~~~~~~~~~~~~

D:\New folder (4)\Arduino\libraries\Adafruit_SH1106-master/Adafruit_SH1106.h:141:7: note:   candidate expects 1 argument, 2 provided

D:\New folder (4)\Arduino\libraries\Adafruit_SH1106-master/Adafruit_SH1106.h:141:7: note: candidate: constexpr Adafruit_SH1106::Adafruit_SH1106(Adafruit_SH1106&&)

D:\New folder (4)\Arduino\libraries\Adafruit_SH1106-master/Adafruit_SH1106.h:141:7: note:   candidate expects 1 argument, 2 provided

Multiple libraries were found for "Adafruit_GFX.h"

 Used: D:\New folder (4)\Arduino\libraries\Adafruit_GFX_Library

 Not used: D:\New folder (4)\Arduino\libraries\ssd1306

exit status 1

no matching function for call to 'Adafruit_SH1106::Adafruit_SH1106(int, int)'

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


I am using this library btw. https://github.com/wonho-maker/Adafruit_SH1106

LightningLion


    *
  • 282
  • Electronics are my thing
Re: electriFi tutorial: build your own OLED display
« Reply #51 on: Oct 01, 2020, 08:31 PM »
Past the code (at least until the setup) here. And remember to use the
{code}{ /code} tags (with [] instead of {}) in the forum to make it look better.

Logged
Lion's electronics corner

Rionu Custom Electronics for your Mandos
--->> Sales thread

WIP's: Post-Imperial costume. Nite Owl helmet.

Mundo Airsofter - Airsoft news & reviews

Zahn Va'roth


    *
  • 288
  • Nu kyr'adyc, shi taab'echaaj'la
Re: electriFi tutorial: build your own OLED display
« Reply #52 on: Oct 01, 2020, 08:46 PM »
I'm a bit confused on how to paste it, but this is the code. I can fix the format if its wrong.
{code}
#include <Adafruit_SH1106.h>
#include <splash.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>


#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

//I2C
#define OLED_RESET 4
Adafruit_SH1106 display(OLED_RESET);
{/code}

« Last Edit: Oct 03, 2020, 02:27 AM by mikehall419 » Logged

LightningLion


    *
  • 282
  • Electronics are my thing
Re: electriFi tutorial: build your own OLED display
« Reply #53 on: Oct 02, 2020, 08:21 PM »
{code}
---Your code goes in here.
{/code}


Which library are you using? And why would you code that has (8. 9)?
Is it with (oled_reset) that you have your screen blank? Do you have anything wired to the pin 4?

As mentioned before, Adafruit changed a bit how their libraries work for these displays. If you're using wonho-maker library, maybe it's no longer compatible with Adafruit GFX.

But first things first! Maybe you don't know the address of the display. Use this sketch to find your display's address:
https://playground.arduino.cc/Main/I2cScanner/

Logged
Lion's electronics corner

Rionu Custom Electronics for your Mandos
--->> Sales thread

WIP's: Post-Imperial costume. Nite Owl helmet.

Mundo Airsofter - Airsoft news & reviews

Zahn Va'roth


    *
  • 288
  • Nu kyr'adyc, shi taab'echaaj'la
Re: electriFi tutorial: build your own OLED display
« Reply #54 on: Oct 04, 2020, 03:33 PM »
Thanks!
So I uploaded the sketch, and the serial monitor reports
{code}
I2C Scanner
Scanning...
{/code}
But that is all it seems to do on mine. Unless it takes a long time?

Also, as a side note, I did find ONE 1306 OLED in 1.3in over on Adafruit.
https://www.adafruit.com/product/938
So in case anyone wants to avoid this hassle.

I bought one, but I still want to figure out how to make this one work.

LightningLion


    *
  • 282
  • Electronics are my thing
Re: electriFi tutorial: build your own OLED display
« Reply #55 on: Oct 04, 2020, 03:57 PM »
It shouldn't take long. Are you sure you have wired it correctly?

Logged
Lion's electronics corner

Rionu Custom Electronics for your Mandos
--->> Sales thread

WIP's: Post-Imperial costume. Nite Owl helmet.

Mundo Airsofter - Airsoft news & reviews

Zahn Va'roth


    *
  • 288
  • Nu kyr'adyc, shi taab'echaaj'la
Re: electriFi tutorial: build your own OLED display
« Reply #56 on: Oct 04, 2020, 04:09 PM »
Okay so my breadboard is a bit wonky, so I rewired it. But now it says-
{code}
Scanning...
No I2C devices found
{/code}
-over and over again.
This means its connected right, right? Or should I solder it together to be sure?

Fi-8015


    *
  • 3702
  • Awards 40% increase or more Award for 10 official invasions.
Re: electriFi tutorial: build your own OLED display
« Reply #57 on: Oct 05, 2020, 03:12 AM »
I'm sorry for what I wrote earlier, of course you need to use the sh1106 library and replace all commands from the ssd1306 library. But it seems you already figured out that I was confused.
I don't know what the other libraries are for, but I guess you'll need the BusIO lib too.
As far as I can tell for now the rest seems fine besides that.
The errors seem to origin from the fact that the function expects to get one value but you supply two (8,9). The code including the "OLED_RESET" should be fine, what happens if you use that one?
I can't help with the I2C Scan, I never had to use it. You should be completely sure that the pins are connected, in cases like that I use a multimeter to check if the connection is the problem.

Logged
Resin helmets for sale in the Trading Station

electriFi - Mando Electronics English / German

Zahn Va'roth


    *
  • 288
  • Nu kyr'adyc, shi taab'echaaj'la
Re: electriFi tutorial: build your own OLED display
« Reply #58 on: Oct 05, 2020, 03:22 AM »
Hey! So I just tried adding the BusIO lib, but that didn't do anything. The screen remains off, and dark.
On the back of the OLED, the address does say you can use 0x7A, or 0x78, but neither of those work either.
I'm quite stumped here!

LightningLion


    *
  • 282
  • Electronics are my thing
Re: electriFi tutorial: build your own OLED display
« Reply #59 on: Oct 05, 2020, 03:36 AM »
The selectable address works this way: You solder the resistor between the center pad and the lef or right pad. That would define the address.
In the picture of the Amazon link you posted the resistor is in the right address (Can't tell if 0x7B or 0x78). In any case, I always use the I2C Scanner to make sure the address in the display is the one it says. it should find devices very quickly.

Wiring is the same it was for the 0.96" display, but double check it.

Post your full code here. And if everything else fails, just try a different library.

Logged
Lion's electronics corner

Rionu Custom Electronics for your Mandos
--->> Sales thread

WIP's: Post-Imperial costume. Nite Owl helmet.

Mundo Airsofter - Airsoft news & reviews

Fi-8015


    *
  • 3702
  • Awards 40% increase or more Award for 10 official invasions.
Re: electriFi tutorial: build your own OLED display
« Reply #60 on: Oct 05, 2020, 07:56 AM »
And do also please add a photo of your wiring.

Logged
Resin helmets for sale in the Trading Station

electriFi - Mando Electronics English / German

Zahn Va'roth


    *
  • 288
  • Nu kyr'adyc, shi taab'echaaj'la
Re: electriFi tutorial: build your own OLED display
« Reply #61 on: Oct 05, 2020, 11:27 PM »
Okay so I ran the address finder on a screen I know works, so I ran it on the smaller 1306 and it found this address.

Then I tried with the same setup on the 1106 one and got this.

Then, I was  moving the board around and the wires a bit and it actually found an address briefly, but I could not get it to do it again. And I did try using that 0x01 as the address, and still nothing.


I'm thinking to solder the wires on, what do you guys think?
Also, here's my current code.

{code}
#include <Adafruit_BusIO_Register.h>
#include <Adafruit_I2CDevice.h>
#include <Adafruit_I2CRegister.h>
#include <Adafruit_SPIDevice.h>

#include <Adafruit_SH1106.h>
#include <splash.h>

#include <Adafruit_GFX.h>




#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>


#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

//I2C
#define OLED_RESET 4
Adafruit_SH1106 display(OLED_RESET);


//software SPI:
//#define OLED_CLK    8       //SCL
//#define OLED_MOSI  9        //SDA
//#define OLED_RESET 10       //RES
//#define OLED_DC    11       //DC
//#define OLED_CS    12       //CS
//Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT,OLED_MOSI, OLED_CLK, OLED_DC, OLED_RESET, OLED_CS);


int xs = 64;  //x für Start
int ys = 32;  //y für Start
int xe = 64;  //x für Ende
int ye = 31;  //y für Ende

int xs1 = 64;  //x für Start
int ys1 = 32;  //y für Start
int xe1 = 64;  //x für Ende
int ye1 = 31;  //y für Ende

int xs2 = 64;  //x für Start
int ys2 = 32;  //y für Start
int xe2 = 64;  //x für Ende
int ye2 = 31;  //y für Ende

int xs3 = 64;  //x für Start
int ys3 = 32;  //y für Start
int xe3 = 64;  //x für Ende
int ye3 = 31;  //y für Ende

int i = 0;

int counter = 0;
int counter1 = 0;
int counter2 = 0;

int targetCounter = 0;
int flickerCounter= 0;

void setup() {
  Serial.begin(9600);
  display.begin(SH1106_SWITCHCAPVCC, 0x3C);  // initialize with the I2C addr 0x3C (for the 128x64)
  display.clearDisplay();

  display.drawRoundRect(0, 0, 128, 64, 6, WHITE);
  display.drawPixel(64,32, WHITE);
  display.drawPixel(63,32, WHITE);
  display.drawPixel(64,31, WHITE);
  display.drawPixel(63,31, WHITE);

  //4 Pixel in der Mitte: x=63, 64  und y = 31, 32

  display.display();

  delay(500);
 
  display.drawLine(33, 1, 94, 62, WHITE);
  display.drawLine(94, 1, 33, 62, WHITE);
 
  display.display();
  delay(500);

  display.drawLine(17, 1, 110, 62, WHITE);
  display.drawLine(110, 1, 17, 62, WHITE);
 
  display.display();
  delay(500);

  display.drawLine(1, 15, 126, 48, WHITE);
  display.drawLine(1, 48, 126, 15, WHITE);
 

  display.display();

  delay(1000);

}

void loop() {

if (targetCounter < 4)
{
while(i<64)
{
  if(i == 16)
  {
    counter = 1;
  }

  if(i == 15)
  {
    counter = 0;
  }

  if(i == 32)
  {
    counter1 = 1;
  }

  if(i == 31)
  {
    counter1 = 0;
  }
 
  if(i == 48)
  {
    counter2 = 1;
  }

  if(i == 47)
  {
    counter2 = 0;
  }
  display.drawLine(xs-1, ys-1, xs-1, ye+1, BLACK);
  display.drawLine(127-xs+1, ys-1, 127-xs+1, ye+1, BLACK);
  display.drawLine(xs-1, ys-1, 127-xs+1, ys-1, BLACK);

  display.drawLine(xs1-1, ys1-1, xs1-1, ye1+1, BLACK);
  display.drawLine(127-xs1+1, ys1-1, 127-xs1+1, ye1+1, BLACK);
  display.drawLine(xs1-1, ys1-1, 127-xs1+1, ys1-1, BLACK);

  display.drawLine(xs2-1, ys2-1, xs2-1, ye2+1, BLACK);
  display.drawLine(127-xs2+1, ys2-1, 127-xs2+1, ye2+1, BLACK);
  display.drawLine(xs2-1, ys2-1, 127-xs2+1, ys2-1, BLACK);

  display.drawLine(xs3-1, ys3-1, xs3-1, ye3+1, BLACK);
  display.drawLine(127-xs3+1, ys3-1, 127-xs3+1, ye3+1, BLACK);
  display.drawLine(xs3-1, ys3-1, 127-xs3+1, ys3-1, BLACK);
 
  if(counter == 1)
  {
    display.drawLine(xs1, ys1, xs1, ye1, WHITE);
    display.drawLine(127-xs1, ys1, 127-xs1, ye1, WHITE);
    display.drawLine(xs1, ys1, 127-xs1, ys1, WHITE);
  }

  if(counter1 == 1)
  {
    display.drawLine(xs2, ys2, xs2, ye2, WHITE);
    display.drawLine(127-xs2, ys2, 127-xs2, ye2, WHITE);
    display.drawLine(xs2, ys2, 127-xs2, ys2, WHITE);
  }

  if(counter2 == 1)
  {
    display.drawLine(xs3, ys3, xs3, ye3, WHITE);
    display.drawLine(127-xs3, ys3, 127-xs3, ye3, WHITE);
    display.drawLine(xs3, ys3, 127-xs3, ys3, WHITE);
  }
 
  if(counter == 0)
  {
    ye1 = 31;
    xe1 = 64;
    ys1 = 32;
    xs1 = 64;
  }

  if(counter1 == 0)
  {
    ye2 = 31;
    xe2 = 64;
    ys2 = 32;
    xs2 = 64;
  }

  if(counter2 == 0)
  {
    ye3 = 31;
    xe3 = 64;
    ys3 = 32;
    xs3 = 64;
  }

  display.drawRoundRect(0, 0, 128, 64, 6, WHITE);
  display.drawLine(33, 1, 94, 62, WHITE);
  display.drawLine(94, 1, 33, 62, WHITE);
 
 
  display.drawLine(17, 1, 110, 62, WHITE);
  display.drawLine(110, 1, 17, 62, WHITE);
 
  display.drawLine(1, 15, 126, 48, WHITE);
  display.drawLine(1, 48, 126, 15, WHITE);


  display.drawLine(xs, ys, xs, ye, WHITE);
  display.drawLine(127-xs, ys, 127-xs, ye, WHITE);
  display.drawLine(xs, ys, 127-xs, ys, WHITE);

  display.fillTriangle(0, 0, 0, 3, 3, 0, BLACK); //Ecken übermalen
  display.fillTriangle(0, 63, 0, 60, 3, 63, BLACK);
  display.fillTriangle(127, 0, 124, 0, 127, 3, BLACK);
  display.fillTriangle(127, 63, 127, 60, 124, 63, BLACK);
 
  display.display();

 
   

   xs ++;
   xe --;
   ys ++;
   ye --;
   i ++;

   if(counter == 1)
   {
   xs1 ++;
   xe1 --;
   ys1 ++;
   ye1 --;
   }

   if(counter1 == 1)
   {
   xs2 ++;
   xe2 --;
   ys2 ++;
   ye2 --;
   }

   if(counter2 == 1)
   {
   xs3 ++;
   xe3 --;
   ys3 ++;
   ye3 --;
   }
}
i = 0;
ye = 31;
xe = 64;
ys = 32;
xs = 64;

targetCounter ++;
}

if (targetCounter == 4)
{
  if(flickerCounter < 24)
  {
display.fillRect(49,17, 30, 30, BLACK);
display.drawLine(48,15, 80, 15, WHITE);
display.drawRoundRect(53, 21, 22,22, 11, WHITE);

display.drawLine(49, 31, 78, 31, WHITE);
display.drawLine(49, 32, 78, 32, WHITE);

display.drawLine(63, 16, 63, 46, WHITE);
display.drawLine(64, 16, 64, 46, WHITE);

display.display();
delay(100);

display.drawLine(49, 31, 78, 31, BLACK);
display.drawLine(49, 32, 78, 32, BLACK);

display.drawLine(63, 16, 63, 46, BLACK);
display.drawLine(64, 16, 64, 46, BLACK);
display.drawRoundRect(53, 21, 22,22, 11, WHITE);
display.display();
delay(100);
flickerCounter ++;
  }

  if(flickerCounter == 24)
  {
    targetCounter = 0;
    flickerCounter = 0;

    display.drawRoundRect(53, 21, 22,22, 11, BLACK);
    display.drawLine(48,15, 80, 15, BLACK);     
  }
}
}
{/code}

EDIT: 10/8/2020
I received in a new display with the 1306 drivers, but I'm confused on where to wire it to the OLED.
https://www.adafruit.com/product/938
I got the example code to work, but the targeting computer does not work. Here is code that works.
Does anyone know what is going on? Btw the pins that work are A4 to DATA, and A5 to C1k.
{code}
/**************************************************************************
 This is an example for our Monochrome OLEDs based on SSD1306 drivers
 Pick one up today in the adafruit shop!
 ------> http://www.adafruit.com/category/63_98
 This example is for a 128x64 pixel display using I2C to communicate
 3 pins are required to interface (two I2C and one reset).
 Adafruit invests time and resources providing this open
 source code, please support Adafruit and open-source
 hardware by purchasing products from Adafruit!
 Written by Limor Fried/Ladyada for Adafruit Industries,
 with contributions from the open source community.
 BSD license, check license.txt for more information
 All text above, and the splash screen below must be
 included in any redistribution.
 **************************************************************************/

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels

// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

#define NUMFLAKES     10 // Number of snowflakes in the animation example

#define LOGO_HEIGHT   16
#define LOGO_WIDTH    16
static const unsigned char PROGMEM logo_bmp[] =
{ B00000000, B11000000,
  B00000001, B11000000,
  B00000001, B11000000,
  B00000011, B11100000,
  B11110011, B11100000,
  B11111110, B11111000,
  B01111110, B11111111,
  B00110011, B10011111,
  B00011111, B11111100,
  B00001101, B01110000,
  B00011011, B10100000,
  B00111111, B11100000,
  B00111111, B11110000,
  B01111100, B11110000,
  B01110000, B01110000,
  B00000000, B00110000 };

void setup() {
  Serial.begin(9600);

  // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3D)) { // Address 0x3D for 128x64
    Serial.println(F("SSD1306 allocation failed"));
    for(;;); // Don't proceed, loop forever
  }

  // Show initial display buffer contents on the screen --
  // the library initializes this with an Adafruit splash screen.
  display.display();
  delay(2000); // Pause for 2 seconds

  // Clear the buffer
  display.clearDisplay();

  // Draw a single pixel in white
  display.drawPixel(10, 10, SSD1306_WHITE);

  // Show the display buffer on the screen. You MUST call display() after
  // drawing commands to make them visible on screen!
  display.display();
  delay(2000);
  // display.display() is NOT necessary after every single drawing command,
  // unless that's what you want...rather, you can batch up a bunch of
  // drawing operations and then update the screen all at once by calling
  // display.display(). These examples demonstrate both approaches...

  testdrawline();      // Draw many lines

  testdrawrect();      // Draw rectangles (outlines)

  testfillrect();      // Draw rectangles (filled)

  testdrawcircle();    // Draw circles (outlines)

  testfillcircle();    // Draw circles (filled)

  testdrawroundrect(); // Draw rounded rectangles (outlines)

  testfillroundrect(); // Draw rounded rectangles (filled)

  testdrawtriangle();  // Draw triangles (outlines)

  testfilltriangle();  // Draw triangles (filled)

  testdrawchar();      // Draw characters of the default font

  testdrawstyles();    // Draw 'stylized' characters

  testscrolltext();    // Draw scrolling text

  testdrawbitmap();    // Draw a small bitmap image

  // Invert and restore display, pausing in-between
  display.invertDisplay(true);
  delay(1000);
  display.invertDisplay(false);
  delay(1000);

  testanimate(logo_bmp, LOGO_WIDTH, LOGO_HEIGHT); // Animate bitmaps
}

void loop() {
}

void testdrawline() {
  int16_t i;

  display.clearDisplay(); // Clear display buffer

  for(i=0; i<display.width(); i+=4) {
    display.drawLine(0, 0, i, display.height()-1, SSD1306_WHITE);
    display.display(); // Update screen with each newly-drawn line
    delay(1);
  }
  for(i=0; i<display.height(); i+=4) {
    display.drawLine(0, 0, display.width()-1, i, SSD1306_WHITE);
    display.display();
    delay(1);
  }
  delay(250);

  display.clearDisplay();

  for(i=0; i<display.width(); i+=4) {
    display.drawLine(0, display.height()-1, i, 0, SSD1306_WHITE);
    display.display();
    delay(1);
  }
  for(i=display.height()-1; i>=0; i-=4) {
    display.drawLine(0, display.height()-1, display.width()-1, i, SSD1306_WHITE);
    display.display();
    delay(1);
  }
  delay(250);

  display.clearDisplay();

  for(i=display.width()-1; i>=0; i-=4) {
    display.drawLine(display.width()-1, display.height()-1, i, 0, SSD1306_WHITE);
    display.display();
    delay(1);
  }
  for(i=display.height()-1; i>=0; i-=4) {
    display.drawLine(display.width()-1, display.height()-1, 0, i, SSD1306_WHITE);
    display.display();
    delay(1);
  }
  delay(250);

  display.clearDisplay();

  for(i=0; i<display.height(); i+=4) {
    display.drawLine(display.width()-1, 0, 0, i, SSD1306_WHITE);
    display.display();
    delay(1);
  }
  for(i=0; i<display.width(); i+=4) {
    display.drawLine(display.width()-1, 0, i, display.height()-1, SSD1306_WHITE);
    display.display();
    delay(1);
  }

  delay(2000); // Pause for 2 seconds
}

void testdrawrect(void) {
  display.clearDisplay();

  for(int16_t i=0; i<display.height()/2; i+=2) {
    display.drawRect(i, i, display.width()-2*i, display.height()-2*i, SSD1306_WHITE);
    display.display(); // Update screen with each newly-drawn rectangle
    delay(1);
  }

  delay(2000);
}

void testfillrect(void) {
  display.clearDisplay();

  for(int16_t i=0; i<display.height()/2; i+=3) {
    // The INVERSE color is used so rectangles alternate white/black
    display.fillRect(i, i, display.width()-i*2, display.height()-i*2, SSD1306_INVERSE);
    display.display(); // Update screen with each newly-drawn rectangle
    delay(1);
  }

  delay(2000);
}

void testdrawcircle(void) {
  display.clearDisplay();

  for(int16_t i=0; i<max(display.width(),display.height())/2; i+=2) {
    display.drawCircle(display.width()/2, display.height()/2, i, SSD1306_WHITE);
    display.display();
    delay(1);
  }

  delay(2000);
}

void testfillcircle(void) {
  display.clearDisplay();

  for(int16_t i=max(display.width(),display.height())/2; i>0; i-=3) {
    // The INVERSE color is used so circles alternate white/black
    display.fillCircle(display.width() / 2, display.height() / 2, i, SSD1306_INVERSE);
    display.display(); // Update screen with each newly-drawn circle
    delay(1);
  }

  delay(2000);
}

void testdrawroundrect(void) {
  display.clearDisplay();

  for(int16_t i=0; i<display.height()/2-2; i+=2) {
    display.drawRoundRect(i, i, display.width()-2*i, display.height()-2*i,
      display.height()/4, SSD1306_WHITE);
    display.display();
    delay(1);
  }

  delay(2000);
}

void testfillroundrect(void) {
  display.clearDisplay();

  for(int16_t i=0; i<display.height()/2-2; i+=2) {
    // The INVERSE color is used so round-rects alternate white/black
    display.fillRoundRect(i, i, display.width()-2*i, display.height()-2*i,
      display.height()/4, SSD1306_INVERSE);
    display.display();
    delay(1);
  }

  delay(2000);
}

void testdrawtriangle(void) {
  display.clearDisplay();

  for(int16_t i=0; i<max(display.width(),display.height())/2; i+=5) {
    display.drawTriangle(
      display.width()/2  , display.height()/2-i,
      display.width()/2-i, display.height()/2+i,
      display.width()/2+i, display.height()/2+i, SSD1306_WHITE);
    display.display();
    delay(1);
  }

  delay(2000);
}

void testfilltriangle(void) {
  display.clearDisplay();

  for(int16_t i=max(display.width(),display.height())/2; i>0; i-=5) {
    // The INVERSE color is used so triangles alternate white/black
    display.fillTriangle(
      display.width()/2  , display.height()/2-i,
      display.width()/2-i, display.height()/2+i,
      display.width()/2+i, display.height()/2+i, SSD1306_INVERSE);
    display.display();
    delay(1);
  }

  delay(2000);
}

void testdrawchar(void) {
  display.clearDisplay();

  display.setTextSize(1);      // Normal 1:1 pixel scale
  display.setTextColor(SSD1306_WHITE); // Draw white text
  display.setCursor(0, 0);     // Start at top-left corner
  display.cp437(true);         // Use full 256 char 'Code Page 437' font

  // Not all the characters will fit on the display. This is normal.
  // Library will draw what it can and the rest will be clipped.
  for(int16_t i=0; i<256; i++) {
    if(i == '\n') display.write(' ');
    else          display.write(i);
  }

  display.display();
  delay(2000);
}

void testdrawstyles(void) {
  display.clearDisplay();

  display.setTextSize(1);             // Normal 1:1 pixel scale
  display.setTextColor(SSD1306_WHITE);        // Draw white text
  display.setCursor(0,0);             // Start at top-left corner
  display.println(F("Hello, world!"));

  display.setTextColor(SSD1306_BLACK, SSD1306_WHITE); // Draw 'inverse' text
  display.println(3.141592);

  display.setTextSize(2);             // Draw 2X-scale text
  display.setTextColor(SSD1306_WHITE);
  display.print(F("0x")); display.println(0xDEADBEEF, HEX);

  display.display();
  delay(2000);
}

void testscrolltext(void) {
  display.clearDisplay();

  display.setTextSize(2); // Draw 2X-scale text
  display.setTextColor(SSD1306_WHITE);
  display.setCursor(10, 0);
  display.println(F("scroll"));
  display.display();      // Show initial text
  delay(100);

  // Scroll in various directions, pausing in-between:
  display.startscrollright(0x00, 0x0F);
  delay(2000);
  display.stopscroll();
  delay(1000);
  display.startscrollleft(0x00, 0x0F);
  delay(2000);
  display.stopscroll();
  delay(1000);
  display.startscrolldiagright(0x00, 0x07);
  delay(2000);
  display.startscrolldiagleft(0x00, 0x07);
  delay(2000);
  display.stopscroll();
  delay(1000);
}

void testdrawbitmap(void) {
  display.clearDisplay();

  display.drawBitmap(
    (display.width()  - LOGO_WIDTH ) / 2,
    (display.height() - LOGO_HEIGHT) / 2,
    logo_bmp, LOGO_WIDTH, LOGO_HEIGHT, 1);
  display.display();
  delay(1000);
}

#define XPOS   0 // Indexes into the 'icons' array in function below
#define YPOS   1
#define DELTAY 2

void testanimate(const uint8_t *bitmap, uint8_t w, uint8_t h) {
  int8_t f, icons[NUMFLAKES][3];

  // Initialize 'snowflake' positions
  for(f=0; f< NUMFLAKES; f++) {
    icons[f][XPOS]   = random(1 - LOGO_WIDTH, display.width());
    icons[f][YPOS]   = -LOGO_HEIGHT;
    icons[f][DELTAY] = random(1, 6);
    Serial.print(F("x: "));
    Serial.print(icons[f][XPOS], DEC);
    Serial.print(F(" y: "));
    Serial.print(icons[f][YPOS], DEC);
    Serial.print(F(" dy: "));
    Serial.println(icons[f][DELTAY], DEC);
  }

  for(;;) { // Loop forever...
    display.clearDisplay(); // Clear the display buffer

    // Draw each snowflake:
    for(f=0; f< NUMFLAKES; f++) {
      display.drawBitmap(icons[f][XPOS], icons[f][YPOS], bitmap, w, h, SSD1306_WHITE);
    }

    display.display(); // Show the display buffer on the screen
    delay(200);        // Pause for 1/10 second

    // Then update coordinates of each flake...
    for(f=0; f< NUMFLAKES; f++) {
      icons[f][YPOS] += icons[f][DELTAY];
      // If snowflake is off the bottom of the screen...
      if (icons[f][YPOS] >= display.height()) {
        // Reinitialize to a random position, just off the top
        icons[f][XPOS]   = random(1 - LOGO_WIDTH, display.width());
        icons[f][YPOS]   = -LOGO_HEIGHT;
        icons[f][DELTAY] = random(1, 6);
      }
    }
  }
}
{/code}

EDIT: 10/09/2020
I GOT IT!
Let me just say thank you guys so much for your help, I couldn't have done it without both of you.
So the address on this Adafruit 1.3in SSD1306 OLED is 0x3D. So that address finder did the trick! Now it works with the standard I2C code!
Thank you guys so much.  :like: ;D

« Last Edit: Oct 09, 2020, 11:09 PM by mikehall419 » Logged

LightningLion


    *
  • 282
  • Electronics are my thing
Re: electriFi tutorial: build your own OLED display
« Reply #62 on: Oct 13, 2020, 01:29 PM »
But did you get the 1106 to work?

Logged
Lion's electronics corner

Rionu Custom Electronics for your Mandos
--->> Sales thread

WIP's: Post-Imperial costume. Nite Owl helmet.

Mundo Airsofter - Airsoft news & reviews

Zahn Va'roth


    *
  • 288
  • Nu kyr'adyc, shi taab'echaaj'la
Re: electriFi tutorial: build your own OLED display
« Reply #63 on: Oct 13, 2020, 03:25 PM »
Still no, it is possible the screen is broken. The address finder can’t really seem to find it.

Re: electriFi tutorial: build your own OLED display
« Reply #64 on: Nov 27, 2020, 10:37 AM »
Hello...I needed to feature the text style tone to understand it.

I understand that little OLED shows are utilized in some PDAs, PDAs, camcorders, and so on, however I comprehend that lifetime for the blue organics is pretty short (~1000 hrs). I think OLED presentations would create a definitive TV or screen on the off chance that they can beat that issue and the significant expense of production.

Logged

Varen Glade


    *
  • *
  • 39
  • Pod Racing is money to.
Re: electriFi tutorial: build your own OLED display
« Reply #65 on: Nov 30, 2020, 04:41 PM »
Has anyone tried it on iPad or Mac??

Logged
One day, we will find the last of the Basilisk Droids.
Logged
Ni'm shi jag trying at gotal'ur ner ara o'r te oyu'baat

LightningLion


    *
  • 282
  • Electronics are my thing
Re: electriFi tutorial: build your own OLED display
« Reply #67 on: Feb 28, 2021, 06:24 PM »
Great job, they look incredible!
How did you make the spinning effect for the medic cross?

Logged
Lion's electronics corner

Rionu Custom Electronics for your Mandos
--->> Sales thread

WIP's: Post-Imperial costume. Nite Owl helmet.

Mundo Airsofter - Airsoft news & reviews
Re: electriFi tutorial: build your own OLED display
« Reply #68 on: Mar 01, 2021, 05:09 PM »
Great job, they look incredible!
How did you make the spinning effect for the medic cross?

I modeled it in solidworks then it is rotated image / image on the right :)

All annimation are picture / picture +/- 20 pictures / annimation

Logged
Ni'm shi jag trying at gotal'ur ner ara o'r te oyu'baat
Re: electriFi tutorial: build your own OLED display
« Reply #69 on: Jun 11, 2022, 05:01 AM »
Hello friends. I am Italian and I apologize for my English.
I would like to make the display I send with red Mandalorian characters. I've never done this, and your post is gorgeous. I ask you if you could give me a hand. maybe someone already has all the material to pass me? I don't know where to start on the code! help Mandalorians!   :boba: :D

Logged

Xander Obsidian


    *
  • 20
  • Be careful, let strength and courage take control
Re: electriFi tutorial: build your own OLED display
« Reply #70 on: Jan 03, 2023, 08:44 AM »
Currently starting my Vambraces, and started the displays for them :D

(I also have another display of my own code displaying "vitals", but I still kinda suck at C++ lol)

Sorry for the image quality, I grabbed an old camera to take the pic because my gf accidentally took my phone, and I do not trust my comp to take a better picture lol

First gauntlet below |
                                    \/
https://imgur.com/a/Pclv5XO

Logged
Re: electriFi tutorial: build your own OLED display
« Reply #71 on: Oct 20, 2023, 02:52 PM »
hey guys im very very new to electronics. i manged to get the GFX test to work on my 1.3 OLED display. but every time i load the mandoputer code it compiles just fine but once its loaded to the Nano only 10 percent of the screen is showing the graphics.
any ideas on how i  can get the image to display on the display ?
like i said big electronics Noob here 

Logged

Corbin Das


    *
  • 83
  • Keeper of the Killer Penny
Re: electriFi tutorial: build your own OLED display
« Reply #72 on: Mar 21, 2024, 11:00 PM »
 Sorry for the necropost, but didn't think starting a new thread on this exact OLED and animation would be appropriate...

 Is there a troubleshooting thread for this OLED? When I plug mine into a USB, the screen doesn't show anything, but the green LED is lit on the board. Hitting the onboard reset button quickly flashes a red LED. It worked when I bought it, but after sitting in a box for a while, now it doesn't.


Thanks

Logged
 


Don't like ads? Help support the Mercs by becoming a Supporter or Auxiliary Member today! (You will need to be logged into the store)
Official Members also get to use the forum ad-free - so kit up and join us!



Powered by EzPortal
SMF spam blocked by CleanTalk