PA Designer Learn 2: LED and Loudness Sensor

9. WHILE loops

To test the loudness sensor, we repeatedly read our sensor using a WHILE loop.

Where a FOR loop repeats a set of instructions a fixed number of times, a WHILE loop repeats those instructions for as long as a condition remains true.

In the test code above, when the program has been running for 10 seconds the elapsed_time() < 10 condition will no longer be true and we will stop looping.