To see what magnitude values your mic is giving you, use the REPL or Read-Eval-Print-Loop on Mu.

There's a print statement I put in the code that prints the value of the mic magnitude every time the program runs through the while loop. You can print any data you want by creating a statement like this. More on printing output in Python here.

print("mag = ", magnitude)

Click on the REPL button at the top of Mu.

led_pixels_image_4KAl3PRDpS.jpeg
Finding the REPL

Next you should see a section at the bottom of the editor pop up. This is where your program output will be sent. If you aren't already getting the magnitude values to print, try clicking in the box that just opened up and doing a control + d, this will start the process of outputting the data. If you want to stop the program from outputting the data, do a control + c.

led_pixels_image_tAU5ILqR1h.jpeg
Microphone magnitude output through the REPL

The REPL can be a great resource to help debug your code. If you have errors in your code, the REPL will tell you what's going wrong and where. Handy!

I know, that was a lot... moving on... to 3D Printing!!!

This guide was first published on Mar 28, 2018. It was last updated on Mar 28, 2018.

This page (The REPL) was last updated on Mar 26, 2018.

Text editor powered by tinymce.