# Remote Control

With Wi-Fi and User Cloud Message, HaloCode can interact with the stage. In this project, we can make a remote control to light up or light off HaloCode's LED ring with stage bulb.

![](/files/-Lpg9cF87961NimwF_0x)

**Enable Upload mode**

![](/files/-Lpg9cF9BTPSQdLN_um8)

**Set the background and sprite**

1\. Delete default sprite Panda

![](/files/-Lpg9cFAI_y2HiEcLhqL)

2\. Under "Background", click "Costumes", and then add background "Office3"

![](/files/-Lpg9cFBOZML-zydMuZC)

3\. Add sprite "bulb", and set the costume to "bulb2"

![](/files/-Lpg9cFCFLxhiu8HUe3E)

4\. Adjust the size of bulb (150% of the original size), and place on the table

![](/files/-Lpg9cFDDbwDGx4ZRuf8)

**Program bulb**

5\. At the bottom of Blocks Area, click "+ extension", and then add User Cloud Message

![](/files/-Lpg9cFEbpF7p8s3MiSW)

6\. Choose Variables block. Click "Make a Variable", and name it "frequency"

![](/files/-Lpg9cFFEOfxHHP1Rajz)

7\. Drag an Events block 当when green flag clicked to the Scripts area, and then add a Variables block set (frequency) to (0)

![](/files/-Lpg9cFGZC5e6HGFsVgM)

8\. Add an Events block when this sprite clicked, a Variables block change (frequency) by (1), and a User Cloud Message block send user cloud message () with value (). Name the message "switch" and add another Variables block frequency

![](/files/-Lpg9cFHKICMcLNwCjXh)

9\. Add a Control block if () then () else (), two Operators blocks () = () and () mod (), a Variables block frequency. Input "2" and "1"

![](/files/-Lpg9cFI0NK0l2wtAnON)

10\. Add two Looks blocks switch costume to (), and choose "bulb-1" and "bulb-2" respectively

![](/files/-Lpg9cFJ0VJTm8wKu60k)

**HaloCode connects Wi-Fi**

11\. Add an Events block when HaloCode starts up, a Wi-Fi block connect to Wi-Fi () password (). Input the network name and password of your Wi-Fi

![](/files/-Lpg9cFKkrOE5pAemp9g)

12\. Add a Control block wait until (), a Wi-Fi block Wi-Fi connected?, a Lighting block all LEDs light up (). Set the color to green. Add another Control block wait (1) seconds, and another Lighting block light off all LEDs

![](/files/-Lpg9cFLnbxL_rsoAWbA)

**HaloCode receives user cloud message**

13\. Add a Wi-Fi block when receiving user cloud message (switch), a Control block if () then () else (), two Operators blocks () = () and () mod (), a Wi-Fi block user cloud message () value. Input "2" and "1"

![](/files/-Lpg9cFM6IdabH9v8Ti6)

14\. Add two Lighting blocks light up all LEDs with color R() G() B() and light off all LEDs

![](/files/-Lpg9cFN2gxLJqPMFQyJ)

15\. Upload the program

![](/files/-Lpg9cFOOU3bzd0_MSim)


---

# 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/level-up/remote-control.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.
