-- Leo's gemini proxy

-- Connecting to gem.librehacker.com:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

Learning Zeptoforth: OLED Display


I have Zeptoforth 1.0.1 installed on my Pico, and I'm learning how to use the bitmap drawing interface for ssd1306-based displays. This communicates over I²C. Here is my display, which is using the string printing interface to display a counter of the microsecond timer register, updating every 10ms:


OLED driven by Rpi Pico and Zeptoforth.


Here is the boilerplate from the example code:


oo import
bitmap import
ssd1306 import
font import
simple-font import

128 constant my-width
64 constant my-height

my-width my-height bitmap-buf-size constant my-buf-size
my-buf-size 4 align buffer: my-buf
<ssd1306> class-size buffer: my-ssd1306
14 15 my-buf my-width my-height SSD1306_I2C_ADDR 1 <ssd1306> my-ssd1306 init-object

init-simple-font

And here is the counter display code:


: my-draw-string op-set my-ssd1306 a-simple-font draw-string ;

: my-update-display my-ssd1306 update-display ;

: display-us-counter begin us-counter <# #s #> 1 1 my-draw-string my-update-display 10 ms again ;

-- Response ended

-- Page fetched on Tue May 21 13:02:34 2024