Skip to content

Instantly share code, notes, and snippets.

@xxlukas42
Created September 7, 2017 21:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xxlukas42/105d236e1313abfccce3acee8b99d7f1 to your computer and use it in GitHub Desktop.
Save xxlukas42/105d236e1313abfccce3acee8b99d7f1 to your computer and use it in GitHub Desktop.
Arduino example of microphone dependent IR signal send for Samsung TV
/*
* IRremote: IRsendDemo - demonstrates sending IR codes with IRsend
* An IR LED must be connected to Arduino PWM pin 3.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
#include <boarddefs.h>
#include <IRremote.h>
#include <IRremoteInt.h>
#include <ir_Lego_PF_BitStreamEncoder.h>
int ledstate = 0;
const int ledPin = 2;
IRsend irsend;
void setup()
{
pinMode(ledPin, INPUT);
Serial.begin(9600);
}
void loop() {
ledstate = digitalRead(ledPin);
// If the signal exceed trashold ledstate goes HIGH
if(ledstate == HIGH) {
Serial.println("CLAP");
// In this moment send IR pulse (2x after 40 ms delay)
for (int i = 0; i < 2; i++) {
irsend.sendSAMSUNG(0xe0e008f7, 32);
delay(40);
}
delay(100);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment