> 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/compare-strength.md).

# 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.
