TurboWarp jsQR

TurboWarp QR input

Read QR text from a named camera.

TurboWarp jsQR consumes frames from Camera Source, decodes QR code text, and can target a dedicated downward-facing camera such as `qr` while TurboWarp TM uses another camera.

wait for QR code on camera qrlast QR text

Blocks

wait for QR code set runtime var

Waits until a QR code is visible on the named camera and stores the decoded text.

wait for QR code and broadcast

Stores the decoded text and starts a broadcast hat after the write.

last QR text

Reports the most recent decoded QR text.

API capability

Unsandboxed extensions can read `Scratch.vm.runtime.ext_kubohiroyajsqr`.

const text = await jsqr.waitForQrText({cameraId: 'qr', signal});
const read = await jsqr.readFrame(frameSource); // { text, bytes, structuredAppend } or null
const textOrNull = await jsqr.scanFrame(frameSource);

`waitForQrText()` acquires the named Camera Source lease, polls frames, releases its lease, and returns the first decoded text.

Setup

Load Camera Source before jsQR. Runtime-variable blocks require the Temporary Variables extension (`lmsTempVars2`). The extension does not upload camera frames.

jsQR: complete block reference

All 3 blocks are documented below, including compatibility blocks and blocks available through optional features. Select a block to read its behavior, arguments, default values, and menu choices. Each block has a permanent link.

wait for QR code on camera [CAMERA_ID] set runtime var [RUNTIME_VAR] to text

Waits until a QR code is detected on the named camera and stores its text in a runtime variable.

Block type: COMMAND. Opcode: waitForQrTextSetRuntimeVar. Permanent link

ArgumentTypeDefault valueMenu choices
CAMERA_IDSTRINGdefault
RUNTIME_VARSTRINGqrText

wait for QR code on camera [CAMERA_ID] set runtime var [RUNTIME_VAR] to text and broadcast [MESSAGE]

Waits until a QR code is detected on the named camera, stores its text, and broadcasts a message.

Block type: COMMAND. Opcode: waitForQrTextSetRuntimeVarAndBroadcast. Permanent link

ArgumentTypeDefault valueMenu choices
CAMERA_IDSTRINGdefault
RUNTIME_VARSTRINGqrText
MESSAGESTRINGqrScanned

last QR text

Returns the most recent QR text detected by this extension.

Block type: REPORTER. Opcode: lastQrTextReporter. Permanent link

This block has no arguments.

Repository guide and examples