soundSensor

Category:Circuit Playground

sensors soundSensor, lightSensor, and tempSensor are objects representing the analog sensors on the Circuit Playground. Internally soundSensor is connected to the analog pin A4, lightSensor is connected to analog pin A5, and tempSensor is connected to analog pin A0.

Properties and Methods

  • soundSensor.value - A number that representing the current input value of the sensor. By default this will range from 0-1023, but that range can be overridden with soundSensor.setScale()
  • soundSensor.setScale() - A method that allows you to change the range of numbers read in by a sensor.
  • tempSensor.F and tempSensor.C - Special properties for the tempSensor which convert the raw input value to either Fahrenheit or Celsius.

Events

  • "change" - Fired any time the input value of the specified sensor changes
  • "data" - Fired every 100 milliseconds.

Found a bug in the documentation? Let us know at documentation@code.org