Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Execute command at certain IR syntax #5

Open
Chickenthief90 opened this issue May 24, 2020 · 2 comments
Open

Execute command at certain IR syntax #5

Chickenthief90 opened this issue May 24, 2020 · 2 comments

Comments

@Chickenthief90
Copy link

Chickenthief90 commented May 24, 2020

What a nice way to get B&O IR into an Arduino!
I already managed to use the SerialDump sketch to read the IR commands send by my Beo6.
The irPin is connected to the IR jack on my Beosystem3 together with a GND connection.

Is it possible to use this library for executing Arduino commands at certain IR command?

For example:
If I would send "Light + 0" from my Beo6, I want to make the Arduino put digital pin 4 HIGH.
(Basic example, what I am working on is being able to control my Hue lights/scenes from the Beo6 remote)

My knowledge of Arduino coding is proving insufficient for this type of engineering.
Any help would be very much appreciated

@Chickenthief90
Copy link
Author

With some trial and error I managed to get the Arduino to do what I want, control a digital pin whenever a specified command has been sent from the Beo6.

For now I have used the following code:
`#include "Beomote.h"

int irPin = 10;

void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);

Beo.initialize(irPin);
}

void loop() {
BeoCommand cmd;

if (Beo.receive(cmd)) {
Serial.print("LINK: ");
Serial.println(cmd.link, DEC);
Serial.print("ADDRESS: ");
Serial.println(cmd.address, DEC);
Serial.print("COMMAND: ");
Serial.println(cmd.command, DEC);
Serial.println(" ");

if ((cmd.link == 0) && (cmd.address == 27) && (cmd.command == 15)) {
  Serial.println("LIGHT OFF");
  Serial.println(" ");
  digitalWrite(LED_BUILTIN, HIGH);
  delay(200);
  digitalWrite(LED_BUILTIN, LOW);
}

if ((cmd.link == 0) && (cmd.address == 27) && (cmd.command == 16)) {
  Serial.println("LIGHT CINEMA");
  Serial.println(" ");
}

if ((cmd.link == 0) && (cmd.address == 27) && (cmd.command == 17)) {
  Serial.println("LIGHT WORK");
  Serial.println(" ");
}

if ((cmd.link == 0) && (cmd.address == 27) && (cmd.command == 18)) {
  Serial.println("LIGHT CHILL");
  Serial.println(" ");
}

}

}`

It might be a little mess but I have just started learning Arduino :-)

@christianlykke9
Copy link
Owner

christianlykke9 commented May 24, 2020

You should take a look at https://create.arduino.cc/projecthub/iotsky/controlling-a-philips-hue-via-a-arduino-b56620.

You can definitely use this library for executing commands when receiving IR-commands from you Bang & Olufsen remote. That is what I originally designed it for :-)

It looks like the Arduino Yun is using the same processor (the same clock speed as Uno) so I think you should be able to translate B&O ir commands to Philips Hue commands and it looks like you have already managed to implement a simple control structure to handle incoming IR commands.

Christian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants