Arnov Sharma
Published © MIT

Transparent OLED Test Board with XIAO

A simple XIAO-Powered board for Transparent OLED Screen

BeginnerFull instructions provided1 hour364

Things used in this project

Hardware components

Seeed Studio XIAO SAMD21 (Pre-Soldered) - Seeeduino XIAO
Seeed Studio XIAO SAMD21 (Pre-Soldered) - Seeeduino XIAO
×1

Software apps and online services

Fusion 360
Autodesk Fusion 360

Hand tools and fabrication machines

Seeed Studio Fusion PCB/PCBA
Seeed Studio Fusion PCB/PCBA
3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Fusion360File

Schematics

sch

Code

code

C/C++
#include <Arduino.h>
#include <U8g2lib.h>

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

#define OLED_DC  0
#define OLED_CS  1
#define OLED_RST 2

U8G2_SSD1309_128X64_NONAME2_1_4W_HW_SPI u8g2(/* rotation=*/U8G2_R0, /* cs=*/ OLED_CS, /* dc=*/ OLED_DC,/* reset=*/OLED_RST);

void setup(void)
{
  u8g2.begin();  //init
  u8g2.setFontPosTop();  /**When you use drawStr to display strings, the default criteria is to display the lower-left
  * coordinates of the characters.The function can be understood as changing the coordinate position to the upper left
  * corner of the display string as the coordinate standard.*/
}


void loop(void)
{
	/*
       * firstPage will change the current page number position to 0
       * When modifications are between firstpage and nextPage, they will be re-rendered at each time.
       * This method consumes less ram space than sendBuffer
   */ 
   u8g2.firstPage();
   for(int i = 64 ; i <287; i++){
   u8g2.clear();
   do
   {
      u8g2.setFont(u8g2_font_open_iconic_all_4x_t );  //Set the font to "u8g2_font_open_iconic_all_4x_t"
      /*
       * Draw a single character. The character is placed at the specified pixel posion x and y. 
	   * U8g2 supports the lower 16 bit of the unicode character range (plane 0/Basic Multilingual Plane): 
	   * The encoding can be any value from 0 to 65535. The glyph can be drawn only, if the encoding exists in the active font.
      */
      u8g2.drawGlyph(/* x=*/0, /* y=*/16, /* encoding=*/i);  
      u8g2.drawGlyph(/* x=*/48, /* y=*/16, /* encoding=*/i+1);  
      u8g2.drawGlyph(/* x=*/96, /* y=*/16, /* encoding=*/i+2);  
   } while ( u8g2.nextPage() );
   i = i+3;
   delay(2000);
  }
}

Credits

Arnov Sharma

Arnov Sharma

275 projects • 288 followers
Just your average MAKER

Comments