NxtSoundSensor

Last Updated On 2021-07-16

Version 1MinSDK 7Tutorial Video

A component that provides a high-level interface to a sound sensor on a LEGO MINDSTORMS NXT robot.


Properties

You can set the below properties in the UI part of the builder.

  • AboveRangeEventEnabled - it's a boolean value which is set to false by default.
  • BelowRangeEventEnabled - it's a boolean value which is set to false by default.
  • BluetoothClient - it's a BluetoothClient value which is set to blank by default.
  • BottomOfRange - it's a non negative integer value which is set to 256 by default.
  • SensorPort - it's a lego nxt sensor port value which is set to 2 by default.
  • TopOfRange - it's a non negative integer value which is set to 767 by default.
  • WithinRangeEventEnabled - it's a boolean value which is set to false by default.

Block Properties

You can set the below blocks properties in the blocks section of the builder.

AboveRangeEventEnabled

Whether the AboveRange event should fire when the sound level goes above the TopOfRange.


BelowRangeEventEnabled

Whether the BelowRange event should fire when the sound level goes below the BottomOfRange.


BottomOfRange

The bottom of the range used for the BelowRange, WithinRange, and AboveRange events.


TopOfRange

The top of the range used for the BelowRange, WithinRange, and AboveRange events.


WithinRangeEventEnabled

Whether the WithinRange event should fire when the sound level goes between the BottomOfRange and the TopOfRange.



Methods

You can set the below method blocks in the blocks section of the builder.

GetSoundLevel

Returns the current sound level as a value between 0 and 1023, or -1 if the sound level can not be read.


Events

You can set the below event blocks in the blocks section of the builder.

AboveRange

Sound level has gone above the range.

BelowRange

Sound level has gone below the range.

WithinRange

Sound level has gone within the range.