#define DECODE_NEC // Includes Apple and Onkyo
#include <IRremote.hpp> // include the library
void setup() {
Serial.begin(115200);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
// Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ " from " __DATE__ "\r\nUsing library version " VERSION_IRREMOTE));
// Start the receiver and if not 3. parameter specified, take LED_BUILTIN pin from the internal boards definition as default feedback LED
IrReceiver.begin(2, ENABLE_LED_FEEDBACK);
Serial.print(F("Ready to receive IR signals of protocols: "));
printActiveIRProtocols(&Serial);
}
void loop() {
if (IrReceiver.decode()) {
IrReceiver.printIRResultShort(&Serial);
IrReceiver.printIRSendUsage(&Serial);
if (IrReceiver.decodedIRData.protocol == UNKNOWN) {
Serial.println(F("Received noise or an unknown (or not yet enabled) protocol"));
// We have an unknown protocol here, print more info
IrReceiver.printIRResultRawFormatted(&Serial, true);
}
Serial.println();
IrReceiver.resume(); // Enable receiving of the next value
if (IrReceiver.decodedIRData.command == 0x10) {
digitalWrite(3,HIGH);
} else if (IrReceiver.decodedIRData.command == 0x11) {
digitalWrite(4,HIGH);
}
else if (IrReceiver.decodedIRData.command == 0x12) {
digitalWrite(5,HIGH);
}
else if (IrReceiver.decodedIRData.command == 0x14) {
digitalWrite(3,LOW);
}
else if (IrReceiver.decodedIRData.command == 0x15) {
digitalWrite(4,LOW);
}
else if (IrReceiver.decodedIRData.command == 0x16) {
digitalWrite(5,LOW);
}
}
}
Hocam kütüphane değişmiş. IRremote kütüphanesi ekledikten sonra Ardunio==>File==>exampls==>Irremote==>simple receiver örneğinden alarak düzenledim bu hali ile tinkercadda calışıyor. 3,4,5 numaralı pinlerde led bağlı 2 numarada kumanda alıcısı