#include <IRremote.h>

int RECV_PIN = 7;
int LED = 13;
int speakerPin = 3;


IRrecv irrecv(RECV_PIN);

decode_results results;

void setup()
{
  Serial.begin(9600);
  irrecv.enableIRIn(); // Start the receiver
  pinMode(LED, OUTPUT);
}

void loop() {
  if (irrecv.decode(&results)) {
    Serial.println(results.value, HEX);
    tone(speakerPin,1000,300);
   
    switch(results.value)

  {

  case 0xC0B92:
    Serial.println("fanculo");
    break;

  case 0xFF629D:
    Serial.println(" CH             ");
    break;
  }
    digitalWrite(LED, HIGH);
    delay(100);
    digitalWrite(LED, LOW);
    delay(100);
   
    irrecv.resume(); // Receive the next value
  }
}























int LEDGreen=9;
int LEDBlue=10;
int LEDRed=11;


int sensorPin=0;
int val;

void setup(){
  Serial.begin(9600);
  pinMode(LEDRed,OUTPUT);
  pinMode(LEDGreen,OUTPUT);
  pinMode(LEDBlue,OUTPUT);
}

void loop(){

  val=map(analogRead(sensorPin),0,1024,0,900);
  Serial.println(val);
  if (val<150) {
    analogWrite(LEDRed,0);
    analogWrite(LEDBlue,255);
    analogWrite(LEDGreen,255);
  } else if (val<300) {
    analogWrite(LEDRed,map(val,150,300,0,255));
    analogWrite(LEDBlue,map(val,150,300,255,0));
    analogWrite(LEDGreen,255);
  } else if (val<450) {
    analogWrite(LEDRed,255);
    analogWrite(LEDBlue,0);
    analogWrite(LEDGreen,255);
  } else if (val<600) {
    analogWrite(LEDRed,255);
    analogWrite(LEDBlue,map(val,450,600,0,255));
    analogWrite(LEDGreen,map(val,450,600,255,0));
  } else if (val<750) {
    analogWrite(LEDRed,255);
    analogWrite(LEDBlue,255);
    analogWrite(LEDGreen,0);
  } else if (val<900) {
    analogWrite(LEDRed,map(val,750,900,255,0));
    analogWrite(LEDBlue,255);
    analogWrite(LEDGreen,map(val,750,900,0,255));
  }
  delay(10);
}





int speakerPin = 9;



int length = 15; // the number of notes

char notes[] = "ccggaagffeeddc "; // a space represents a rest

int beats[] = { 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 4 };

int tempo = 300;



void playTone(int tone, int duration) {

  for (long i = 0; i &lt; duration * 1000L; i += tone * 2) {

    digitalWrite(speakerPin, HIGH);

    delayMicroseconds(tone);

    digitalWrite(speakerPin, LOW);

    delayMicroseconds(tone);

  }

}



void playNote(char note, int duration) {

  char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };

  int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956 };



  // play the tone corresponding to the note name

  for (int i = 0; i &lt; 8; i++) {

    if (names[i] == note) {

      playTone(tones[i], duration);

    }

  }

}



void setup() {

  pinMode(speakerPin, OUTPUT);

}



void loop() {

  for (int i = 0; i &lt; length; i++) {

    if (notes[i] == ' ') {

      delay(beats[i] * tempo); // rest

    } else {

      playNote(notes[i], beats[i] * tempo);

    }



    // pause between notes

    delay(tempo / 2);

  }

}