Skip to content

Edge triggered hats should not trigger when green flag is clicked #2066

Open
@BryceLTaylor

Description

@BryceLTaylor

Expected Behavior

An edge triggered hat, such as the When distance < 50 block, should not trigger when the green flag is clicked unless the condition of the hat goes from false to true.

Actual Behavior

If there is no distance sensor sending data (or no Wedo connected) the when distance < 50 block value defaults to 0. When the green flag is clicked the it seems that the hat is briefly evaluated to false and then a moment later evaluated to true, causing the hat to trigger. This means that every time you click the green flag the hat triggers once even though the value does not change.

This also comes up with the when brightness < 50 and when distance < 5 blocks from the ev3 extension. This behavior is not exhibited on other blocks that I've seen. I see it in hats that test a value that defaults to 0 without input. They are unexpectedly getting a false value after clicking the green flag and then a true one, thereby triggering the hat.

Steps to Reproduce

Create a new project
Add the LEGO Wedo 2 extension (no need to actually connect a wedo)
Create a block stack that says When distance < 50 Play sound meow
Click the green flag
Note: the meow sound plays

Operating System and Browser

Mac Chrome

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions