> 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/workshop/a-kitten-with-blinking-eyes-and-a-waving-tail.md).

# A Kitten with Blinking Eyes and a Waving Tail

**Tools and materials:**\
one HaloCode, crocodile clip or wire, one battery box, a pair of scissors, one puncher, one ruler, some cardboard, some double-sided tapes, DuPont wire, 9g servo motor (3.3V).

**Make a kitten**

Draw the kitten's body and tail on the cardboard, and then cut them out. Use the puncher to make two holes as the eyes of kitten.

**Note: the distance of the two eyes should equal to the greatest distance between two LEDs of HaloCode.**

![](/files/-LpgAJ_9f2cscEA3hKQ2)

Connect the servo motor to HaloCode (any of the four pins will work), as follows:

* The red line of the servo means the positive pole, and is connected to the red line of the alligator clip, which is connected to the 3.3v pin of HaloCode.
* The black line of the servo means the negative pole, and is connected to the blue line of the alligator clip, which is connected to the GND pin of HaloCode.
* The white line of the servo is the communication line, and is connected to the yellow line of the alligator clip, which can be connected to any touchpad of HaloCode. We'll use touchpad0 in this example.

![](/files/-LpgAJ_AHROGmxDitiBX) ![](/files/-LpgAJ_BXtWQH_qsXaqU) ![](/files/-LpgAJ_CGx4I7gEC7lye)

Stick the tail to the servo motor. Connect the body and tail of the kitten with HaloCode, the servo motor, and the battery box.

![](/files/-LpgAJ_DW_H0l6y7OjmZ) ![](/files/-LpgAJ_Enbns8hWphg0M) ![](/files/-LpgAJ_Fd_VkWlbv76sA)

**Toggle on Upload mode**

![](/files/-LpgAJ_GfCL5AYqvzEmc)

**Script of Blinking Eyes**

1\. Drag an Events block when HaloCode starts up and a Control block forever to the Scripts area.

![](/files/-LpgAJ_HMjrSqaxwUY1j)

2\. Add a Lighting block all the LEDs light up () and a Control block wait () seconds. Set the color to white. We want the kitten to blink eyes randomly, so we need an Operators block pick random () to (), and input number 2 and 6. Add a Lighting block light off all the LEDs and another Control block wait () seconds. Set the time to 0.2 second.

![](/files/-LpgAJ_Iyg4Hecl-vcCo)

**Script of the Waving Tail**

3\. Drag an Events block when HaloCode starts up and a Control block forever to the Scripts area.

![](/files/-LpgAJ_JqW07y6MYUSzh)

4\. Add a Pins block servo pin () rotates to () and a Control block wait () seconds. Set the degree to 0 and keep the default time.

![](/files/-LpgAJ_KtzlKNyXlzxkx)

5\. Add another Pins block servo pin () rotates to () and Control block wait () seconds. Both keep the default value.

![](/files/-LpgAJ_LIqUCabrsoHMF)

6\. Click "Upload" to upload the program to HaloCode.

7\. Check the kitten! Is it blinking eyes and waving its tail at the same time?

![](/files/-LpgAJ_Mo67KWA3_9PgN)


---

# 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, and the optional `goal` query parameter:

```
GET https://learn.pakronics.com.au/halocode-1/code-with-mu-a-simple-python-editor/examples/workshop/a-kitten-with-blinking-eyes-and-a-waving-tail.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
