# Compare Strength

**Programming Result**

![](/files/-Lpg6HCz8Rvv7HHM-SCR)

**Introduction to HaloCode's motion sensor**

The motion sensor detects how HaloCode moves, including shaking strength.

![](/files/-Lpg6HD-qOTCSiAB-nHh)

**Set the range of shaking strength**

1\. Drag an Operators block () > () to the Scripts area, and change the value of the second parameter to "30". Add a Sensing block shaking strength to the first parameter.

![](/files/-Lpg6HD05H2wuAERmorK)

2\. Add a Control block if () then ().

![](/files/-Lpg6HD1IxoQzYTV6026)

**Set LED animation**

3\. Add a Lighting block all LEDs light up (), and a Control block wait () seconds. Add another Lighting block light off all LEDs to light off all LEDs in 1 second.

![](/files/-Lpg6HD2DKjsfbDpHKqX)

4\. Likewise, for shaking strength greater than 60, we can duplicate the script. Change the value to 60 and LED color to red.

![](/files/-Lpg6HD3lFX2WQY2GxLG)

**Add event and control**

5\. Add an Events block when HaloCode is shaking and a Control block forever.

![](/files/-Lpg6HD4fAdiOBLBZz3b)

**Read shaking strength**

6\. Check the box for Sensing block shaking strength.

![](/files/-Lpg6HD58pgqXmWSIQ5A)

7\. Shake HaloCode! See if you can make the LED ring light up red.


---

# Agent Instructions: 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/compare-strength.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.
