Skip to content

Nondzu/ssd1306_font

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ssd1306 font

This is lite ssd1306 font library using TinyGo. Tested on Raspberry Pi Pico.

Example:

package main

import (
	"machine"
	"time"

	font "github.com/Nondzu/ssd1306_font"
	"tinygo.org/x/drivers/ssd1306"
)

func main() {

	time.Sleep(time.Millisecond * 100) // Please wait some time after turning on the device to properly initialize the display
	machine.I2C0.Configure(machine.I2CConfig{Frequency: 400000})

	// Display
	dev := ssd1306.NewI2C(machine.I2C0)
	dev.Configure(ssd1306.Config{Width: 128, Height: 64, Address: 0x3C, VccState: ssd1306.SWITCHCAPVCC})
	dev.ClearBuffer()
	dev.ClearDisplay()

	//font library init
	display := font.NewDisplay(dev)
	display.Configure(font.Config{FontType: font.FONT_7x10}) //set font here

	display.YPos = 20                 // set position Y
	display.XPos = 0                  // set position X
	display.PrintText("HELLO WORLD!") // print text

	for {

	}
}

FONT_6x8

FONT_6x8

FONT_7x10

FONT_7x10

FONT_11x18

FONT_11x18

FONT_16x26

FONT_16x26