print("This program integrates OLED screen with ESP32")
# Credits to https://RandomNerdTutorials.com & program edited accordingly
#1. Import necessary module/libraries
from machine import Pin, SoftI2C # SoftI2C = SCL, SDA
####from utime import sleep#### no need boleh buang je
import ssd1306 #import OLED libraries
#Pin declaration on OLED
i2c_oled = SoftI2C(scl=Pin(22), sda=Pin(21))
#3. Define the OLED variables
oled_width = 128 #based on spec
oled_height = 64 #based on spec
#4. use OOP (object Oriented Programming) to create the object
#Remarks : object format --> library name.class name
oled = ssd1306.SSD1306_I2C(oled_width, oled_height, i2c_oled)
#5.test our LED Display
#Create text to be displayed on OLED screen
#Remarks : Code Colour is 1 for white, 0 for black (By default : 1)
oled.fill(2)
oled.text('Hello Everyone', 0, 10, 0)
oled.text('I am Azamuddin', 0, 30, 0)
oled.text('I like IOT subject', 0, 50, 0)
oled.text('BEB34303', 0, 0, 0)
oled.show()
sleep(3)
oled.invert(True)
oled.show()