> For the complete documentation index, see [llms.txt](https://docs.petoi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.petoi.com/biboard/demo-applications/7.infrared-remote-control.md).

# 7.Infrared remote control

BiBoard is equipped with an infrared sensor, which is connected to the 23rd pin. The use of infrared is exactly the same as which is on Arduino UNO based on AVR.

First download the 2.6.1 version of the IRremote library, you need to manually select the 2.6.1 version. Because the infrared-related codes have changed in later versions, if you use the 3.X version, the commands will not be translated. In order to be compatible with our previous products, we decided to use the 2.6.1 version after testing.

![](https://1565080149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQ6a951Q6Jn1Zzt5Ajr%2F-McDOJfWEXYbypZqK0XI%2F-McDQ_3-NNjGtnIW3heF%2F001.JPG?alt=media\&token=eeb1e09c-1c54-4dde-874d-5a519485db7c)

When using NyBoard, in order to ensure that the code can be compiled smoothly, we need to remove unnecessary code in the IRremote library, that is, remove the encoder/decoder that we don't use, and only keep the NEC\_DECODER, which is the 38KHz signal decoder in NEC format.

Due to the flash memory capacity of BiBoard is “huge”, we don’t need to remove unnecessary code in the IRremote library.

![23% of flash is used on UNO](https://1565080149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQ6a951Q6Jn1Zzt5Ajr%2F-Mchmf5yTS0QgJxZLh5K%2F-MchmuTJ0cgZ5bVpx635%2F07_01.png?alt=media\&token=8adb7ee2-2b09-4af9-9c32-c8340a93531c)

![Only 4% of flash is used on BiBoard](https://1565080149-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MQ6a951Q6Jn1Zzt5Ajr%2F-Mchmf5yTS0QgJxZLh5K%2F-Mchn9LNPmtnHIslGemM%2F07_02.JPG?alt=media\&token=dae50981-2cf3-4293-aa2f-31929bcc8307)

Finally, a demo is attached, which accepts infrared signals and prints via the serial port. You can also use official demo for testing.

```cpp
#include <Arduino.h>
#include <IRremote.h>

int RECV_PIN = 23;

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup() {
  Serial.begin(115200);
  irrecv.enableIRIn();
  Serial.println("IR Receiver ready");
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    Serial.print(" - ");
    irrecv.resume(); // Receive the next value
  }
  delay(300);
}
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.petoi.com/biboard/demo-applications/7.infrared-remote-control.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
