Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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