(Citation needed)
m (Importing images from scratch.wikia.com; everything should be imported now.)
(18 intermediate revisions by 9 users not shown)
Line 1: Line 1:
{{expand}}
+
{{block
{{Block
 
 
|name = When Distance () ()
 
|name = When Distance () ()
|image = File:2.0 When Distance is Less Than ().png
+
|image = when distance [ v] ()::wedo
 
|category = [[LEGO WeDo Blocks|LEGO WeDo]]
 
|category = [[LEGO WeDo Blocks|LEGO WeDo]]
 
|type = [[Hat Block|Hat]]
 
|type = [[Hat Block|Hat]]
 
|added = [[2.0]]
 
|added = [[2.0]]
 +
|sb = yes
 
}}
 
}}
The '''When Distance () ()''' [[Blocks|block]] is a [[LEGO WeDo Blocks|LEGO WeDo block]] and a [[Hat Block|Hat block]]. The block activates when the [[Distance (block)|distance]] is less than or greater than the specified value, depending on the argument selected from the drop-down menu. Prior to [[Scratch 2.0]], this block did not take a comparison argument but remained with a less-than sign constantly. This block is not very commonly used. {{citation needed}}
+
The '''When Distance () ()''' [[block]] is a [[LEGO WeDo Blocks|LEGO WeDo block]] and a [[Hat Block|Hat block]]. The block activates when the [[Distance (block)|distance]] is less than or greater than the specified value, depending on the argument selected from the drop-down menu. Prior to [[Scratch 2.0]], this block did not take a comparison argument but remained with a less-than sign constantly.
  
 
This block can only be used with a [[LEGO WeDo Construction Set]].
 
This block can only be used with a [[LEGO WeDo Construction Set]].
 +
 +
== Uses ==
 +
Some example uses for this block are:
 +
 +
* Activating a motor when the distance sensor is activated
 +
<scratchblocks>
 +
when distance [< v] (10)::wedo
 +
turn [motor v] on for (0.25) seconds::wedo
 +
</scratchblocks>
 +
* Reporting the distance when it is less than a specified value
 +
<scratchblocks>
 +
when distance [< v] (50)::wedo
 +
repeat until <(distance::wedo) > (50)>
 +
say (distance::wedo)
 +
</scratchblocks>
  
 
==See Also==
 
==See Also==
*[[When Tilt = () (block)|When Tilt = ()]]
+
* [[Distance (block)|Distance]]
*[[Distance (block)|Distance]]
+
* [[When Tilt () () (block)|When Tilt () ()]]
 
{{LEGO WeDo Blocks}}
 
{{LEGO WeDo Blocks}}
 
[[Category:LEGO WeDo Blocks]]
 
[[Category:LEGO WeDo Blocks]]
 
[[de:Wenn Abstand kleiner () (Block)]]
 
[[de:Wenn Abstand kleiner () (Block)]]
 +
[[ja:距離 () () のとき (ブロック)]]

Revision as of 18:21, 2 January 2020

When Distance () ()
when distance [ v] ()::wedo
Category LEGO WeDo
Type Hat
Introduced in 2.0

The When Distance () () block is a LEGO WeDo block and a Hat block. The block activates when the distance is less than or greater than the specified value, depending on the argument selected from the drop-down menu. Prior to Scratch 2.0, this block did not take a comparison argument but remained with a less-than sign constantly.

This block can only be used with a LEGO WeDo Construction Set.

Uses

Some example uses for this block are:

  • Activating a motor when the distance sensor is activated
when distance [< v] (10)::wedo
turn [motor v] on for (0.25) seconds::wedo
  • Reporting the distance when it is less than a specified value
when distance [< v] (50)::wedo
repeat until <(distance::wedo) > (50)>
say (distance::wedo)

See Also