Created
September 7, 2017 21:53
-
-
Save xxlukas42/105d236e1313abfccce3acee8b99d7f1 to your computer and use it in GitHub Desktop.
Arduino example of microphone dependent IR signal send for Samsung TV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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