Skip to content
This repository was archived by the owner on Dec 8, 2025. It is now read-only.

Commit 1a4f93e

Browse files
committed
better old sample
1 parent 1878ed2 commit 1a4f93e

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
import { pins, board } from "@dsboard/pico_bricks"
22
import { SSD1306Driver, startIndexedScreen } from "@devicescript/drivers"
3+
import { delay } from "@devicescript/core"
34

45
const screen = await startIndexedScreen(
56
new SSD1306Driver({ width: 128, height: 64 })
67
)
7-
let i = 0
8-
setInterval(async () => {
9-
console.log(i)
10-
screen.image.fill(0)
11-
screen.image.print(`Hello world! ${i++}`, 3, 10)
12-
await screen.show()
13-
}, 1000)
8+
const image = screen.image
9+
image.fill(0)
10+
await screen.show()
11+
for (let x = 0; x < image.width; x += 2) {
12+
for (let y = 0; y < image.height; y += 2) {
13+
image.set(x, y, 1)
14+
await screen.show()
15+
await delay(10)
16+
}
17+
}

0 commit comments

Comments
 (0)