Changing Sensor Scale

By default each of the analog sensors on the Circuit Playground converts their sensed data to a 10 bit number with a minimum value of 0 and a maximum of 1023. While this range provides the most detailed readings (since there are 1024 possible values), it's not always the most useful range of numbers. If you want to use a sensor input to control rgb color, display a percentage, or otherwise want to constrain the potential values of the sensor inputs you'll need to map the range of 0-1023 to another range.

Set Scale

The setScale method allows you to override the default range of a an analog sensor. For example, calling soundSensor.setScale(0, 100) will change the scale of the soundSensor.value so that the lowest value (completely silent) is 0, and the highest (full noisey) is 100.

Found a bug in the documentation? Let us know at