# Programming with MicroPython: ASR Voice Recognition Module

### Import ASR Library

Import SugarASR library to make use of its functions.

```
from sugar_asr import SugarASR
```

### 15: ASR Voice Recognition Module

### Initiate ASR Module

```
asr = SugarASR(tx, rx)
```

Creates an ASR object.

* tx: Tx Pin, use “P2” for Robotbit Edu.
* rx: Rx Pin, use “P12” for Robotbit Edu.

### ASR Triggered State

```
asr.detected()
```

Returns the state of ASR module. Returns true when a command is heard, false when a command is not heard.

### Get ASR Command

```
asr.cmdParse()
```

Returns the command ID for the voice command heard by the ASR. Refer to the following table for a list of commands.

![](https://kittenbothk-eng.readthedocs.io/en/latest/_images/asr_codes.png)

### ASR Play Speech

```
asr.tts_words(1)
```

Plays the speech indicated by the ID.

### ASR Say Number

```
asr.tts_int(1) #Integer
asr.tts_double(1.1) #Double, maximum 2 decimal digits
```

Say the number provided.

### ASR Say Time

```
asr.tts_clock(hour, min)
```

Say the time provided.


---

# 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://sharinghub-eng.kittenbot.hk/main-controllers/futureboard/futureboard-micropython-programming-tutorial/programming-with-micropython-asr-voice-recognition-module.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.
