Skip to content

Simple Arduino library for sending NEC protocol IR messages from a Zumo32u4 car

License

Notifications You must be signed in to change notification settings

trondfc/Zumo32u4IRsender

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zumo32u4IRsender

Simple Arduino library for sending NEC protocol IR messages from a Zumo32u4 robot.

The library uses the robots built in IR LED normally used for proximity sensing. Due to this, it is not possible to use the library and the proximity sensing at the same time, but they should be usable in alternation.

Usage

The library is used by including the header file and creating an instance of the Zumo32u4IRsender class. The constructor takes arguments for the device ID and the side of the robot the IR LED is on. The device ID is used to identify the robot and is sent with every message. The side argument is used to determine the direction of the IR LEDs used.

If neaded, the device ID can also be changed by calling the setDeviceId function, and the side can be changed by calling the setDirection function.

For sending of IR messaged the function send is used. It takes a single argument, the message byte to be sent. This byte then gets sent along with the device ID in a NEC protocol message.

Both the device ID and the message are max 8 bits (0-255)

image

Functions

// example id = 42
Zumo32U4IRsender ZumoIrSender(42, RIGHT_IR);
// example id = 42
  ZumoIrSender.setDeviceId(42)
ZumoIrSender.setDirection(RIGHT_IR)
// example message = 0x11
ZumoIrSender.send(0x11);

Example

#include <Zumo32u4IRsender.h>

#define DEVICE_ID 0x01
#define DIRECTION RIGHT_IR

Zumo32U4IRsender ZumoIrSender(DEVICE_ID, DIRECTION);

void setup() {
}

void loop() {
  ZumoIrSender.send(0x11);
  delay(1000);
}

About

Simple Arduino library for sending NEC protocol IR messages from a Zumo32u4 car

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages