Skip to content

Commit 2227084

Browse files
committed
Tweak order. Add comments.
1 parent c5e4dae commit 2227084

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

Introducing_CircuitPlaygroundExpress/CircuitPlaygroundExpress_SoundMeter.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,27 @@
2121
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
# THE SOFTWARE.
2323

24+
# Circuit Playground Sound Meter
25+
2426
import array
2527
import math
2628
import audiobusio
2729
import board
2830
import neopixel
2931

32+
# Color of the peak pixel.
3033
PEAK_COLOR = (100, 0, 255)
34+
# Number of total pixels - 10 build into Circuit Playground
3135
NUM_PIXELS = 10
3236

33-
# Number of samples to read at once.
34-
NUM_SAMPLES = 160
35-
3637
# Exponential scaling factor.
3738
# Should probably be in range -10 .. 10 to be reasonable.
3839
CURVE = 2
3940
SCALE_EXPONENT = math.pow(10, CURVE * -0.1)
4041

42+
# Number of samples to read at once.
43+
NUM_SAMPLES = 160
44+
4145

4246
# Restrict value to be between floor and ceiling.
4347
def constrain(value, floor, ceiling):

0 commit comments

Comments
 (0)