> For the complete documentation index, see [llms.txt](https://learn.pakronics.com.au/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.pakronics.com.au/halocode-1/code-with-mu-a-simple-python-editor/examples/basic-project/make-a-volume-detector.md).

# Make a Volume Detector

Make a volume detector with HaloCode. Use the microphone of HaloCode to detect loudness and visualize the the value with the LED ring. The louder the sound is, the more LEDs will light up.

1\. Drag an Events block when button is pressed to the Scripts area.

![](/files/-Lpg6r-dfHZXCdDmSgWU)

2\. Add a Control block forever.

![](/files/-Lpg6r-ecUr5jrYNH-Ta)

3\. Add a Lighting block LED ring shows ()% and a Sensing block microphone loudness.

![](/files/-Lpg6r-fnm38VWJPceZN)

4\. Try hitting the table and check the LED ring of HaloCode.

![](/files/-Lpg6r-gPn9JWwGiER44)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://learn.pakronics.com.au/halocode-1/code-with-mu-a-simple-python-editor/examples/basic-project/make-a-volume-detector.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
