You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current Scratch API requires an explicit busy loop, testing at a fixed cadence whether sensors have changed state to decide what commands to send to the robots. This doesn't agree with the Scratch event-driven paradigm and requires students to write unnatural programs. Since events are tested in order it also can create starvation, or require students to implement their own fair scheduler.
The Scratch API should provide hat blocks that trigger scripts when discrete events occur. These events could be:
Proximity sensor changes state
Proximity sensor detects color change
Camera detects an object by YOLO
Camera detects fiducial marker
Proximity sensor detects gesture
Message received over local are network
Implementing hat blocks using the Scratch Extension framework is not particularly well documented, but is not hard. There is a BlockType.HAT and there are examples for the Lego Boost in the official extensions:
The current Scratch API requires an explicit busy loop, testing at a fixed cadence whether sensors have changed state to decide what commands to send to the robots. This doesn't agree with the Scratch event-driven paradigm and requires students to write unnatural programs. Since events are tested in order it also can create starvation, or require students to implement their own fair scheduler.
The Scratch API should provide hat blocks that trigger scripts when discrete events occur. These events could be:
Camera detects fiducial markerProximity sensor detects gestureMessage received over local are networkImplementing hat blocks using the Scratch Extension framework is not particularly well documented, but is not hard. There is a
BlockType.HAT
and there are examples for the Lego Boost in the official extensions:Opcode
whenColor
:https://github.com/LLK/scratch-vm/blob/f71f2b7fe2a5a0ff44f7bb53ef78beb2991314df/src/extensions/scratch3_boost/index.js#L1423-L1438
Implementation of the
whenColor
edge trigger:https://github.com/LLK/scratch-vm/blob/f71f2b7fe2a5a0ff44f7bb53ef78beb2991314df/src/extensions/scratch3_boost/index.js#L2053-L2070
The text was updated successfully, but these errors were encountered: