Skip to content

Instantly share code, notes, and snippets.

@jlamch
Created January 19, 2020 18:50
Show Gist options
  • Save jlamch/125ac55bce7242e6f31af177366d2f77 to your computer and use it in GitHub Desktop.
Save jlamch/125ac55bce7242e6f31af177366d2f77 to your computer and use it in GitHub Desktop.
#include "OledDisplay.h"
void setup() {
  //screen
  Screen.init();
}
void loop() {
  oledPlay();
}
void oledPlay()
{
  Screen.clean();
  Screen.print("1. Some long text that should go to next lines");
  delay(3000);
  Screen.clean();
  Screen.print("2. Some long text that should go to\nnext lines", true);
  delay(3000);
  Screen.clean();
  Screen.print(0, "3. short text");
  Screen.print(1, "splited in lines");
  Screen.print(2, "there is only");
  Screen.print(3, "3 lines. ");
  delay(3000);
  Screen.clean();
  char out [300];
  sprintf(out, "ID: %s\r\n Humid: %d\r\n Temp: %d\r\n", 144, 0, 0);
  Screen.print( out, true);
unsigned char BMP[1024] ; 
  for (size_t j = 0; j < 8; j++)
  {
    for (size_t i = 0; i < 128; i++)
    {
      int a= j*128 + i;
      if( a % 8 == 0 && j %2 ==0)
      {
        BMP[a] = 255;
      }
      else
      {
        BMP[a] = 0;
      }      
    }   
  }
  // draw a bitmap to the screen
  Screen.clean();
  Screen.draw(0, 0, 128, 8, BMP);
  delay(3000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment