pdf-icon

Arduino Quick Start

2. Devices & Examples

6. Applications

Atom EchoS3R IR Transmitter

APIs and example programs related to IR (Infrared) transmission on Atom EchoS3R.

Example Program

Compilation Requirements

  • M5Stack board manager version >= 3.2.2
  • Board option = M5AtomS3R
  • M5Unified library version >= 0.2.8
  • Arduino-IRremote library version >= 4.5.0
cpp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
// Disable receiver functions will save program memory and RAM.
#define DISABLE_CODE_FOR_RECEIVER
#define NO_LED_SEND_FEEDBACK_CODE
#define NO_LED_FEEDBACK_CODE
#define SEND_PWM_BY_TIMER
#define IR_TX_PIN 47

#include "M5Unified.h"
// Third-party library: https://github.com/Arduino-IRremote/Arduino-IRremote
#include <IRremote.hpp>

uint16_t sAddress = 0x1234;
uint8_t sCommand  = 0x56;
uint8_t sRepeats  = 0;

void setup() {
  M5.begin();
  Serial.begin(115200);

  IrSender.begin(IR_TX_PIN);
}

void loop() {
  Serial.println("Sending standard NEC signal with 16 bit address: ");
  Serial.printf("address=0x%x, command=0x%x, repeats=%d\n\n", sAddress, sCommand, sRepeats);

  IrSender.sendNEC(sAddress, sCommand, sRepeats);

  sCommand += 1;
  delay(1000);
}

This program will send incrementing command numbers to the address specified in the code via infrared using the NEC protocol.

API

The IR transmission part of Atom EchoS3R uses the Arduino-IRremote library. For more related APIs, please refer to the following documentation:

On This Page