Sunday, April 2, 2023

Attiny85 oled 64x32 hello world

 



code for arduino oled screen 64x32 :


Dont forget to install library ssd1306 mininal and Tinywire

----------------------------------------------------------------------------

#include "SSD1306_minimal.h"

#include <avr/pgmspace.h>


#define DEG "\xa7" "C"


SSD1306_Mini oled; // Declare the OLED object


void splash() {

 oled.startScreen();

 oled.clear(); // Clears the display


 oled.cursorTo(32, 4); // x:0, y:0

 oled.printString("Hello");

 delay(2000);

 oled.cursorTo(32, 5); // x:0, y:23

 oled.printString("ATtiny85");

delay(2000);

 oled.cursorTo(32, 6); // x:0, y:23

 oled.printString("Hacktuber");

delay(2000);

 oled.cursorTo(32, 7); // x:0, y:23

 oled.printString("YouTube");

 delay(2000);

}


void setup() {

 oled.init(0x3C); // Initializes the display to the specified address

 oled.clear(); // Clears the display

 delay(1000); // Delay for 1 second

 splash(); // Write something to the display (refer to the splash() method

}


void loop() {

}

No comments:

Post a Comment