ciao a tutti!
mi servirebbe una mano nel creare uno sketch dove al ricevere di un qualsiasi segnare ir arduino accenda un led con una dissolvenza come conferma dell'avvenuta ricezione del segnale e poi lo spenga...
ho provato così ma non funge perchè? =(
#include <IRremote.h> // use the library for IR
int receiver = 10; // pin 1 of IR receiver to Arduino digital pin 11
int led = 9;
int brightness = 0; // how bright the LED is
int fadeAmount = 5; // how many points to fade the LED by
IRrecv irrecv(receiver); // create instance of 'irrecv'
decode_results results;
void setup()
{
pinMode(led, OUTPUT);
irrecv.enableIRIn();
}
void loop()
{
if (irrecv.decode(&results))
{
if (results.value == 0xE0E036C9){
analogWrite(led, brightness);
// change the brightness for next time through the loop:
brightness = brightness + fadeAmount;
// reverse the direction of the fading at the ends of the fade:
if (brightness == 0 || brightness == 255) {
fadeAmount = -fadeAmount ;
}
// wait for 30 milliseconds to see the dimming effect
delay(30);
}
irrecv.resume();
}
}
edit by mod: rispettiamo il regolamento, per favore, quando si aprono nuovi thread (visto che sei nuovo, sarebbe stato gradito che il 1° post tu lo avessi usato per presentarti e non per una richiesta d'aiuto.