// 1= FF30CF #include int RECV_PIN = 12; // Infrared receiving pin int velocita; // Comandi IR long ir_zero = 16724175; long ir_uno = 16724175; long ir_due = 16724175; long ir_tre = 16724175; long ir_quattro = 16724175; long ir_cinque = 16724175; long ir_sei = 16724175; long ir_sette = 16724175; long ir_otto = 16724175; long ir_nove = 16724175; long ir_start = 16724175; long ir_stop = 16724175; long ir_piu = 16724175; long ir_meno = 16724175; IRrecv irrecv(RECV_PIN); // Create a class object used to receive class decode_results results; // Create a decoding results class object void setup() { Serial.begin(9600); // Initialize the serial port and set the baud rate to 9600 irrecv.enableIRIn(); // Start the receiver } void loop() { // Attendo comando da telecomando IR if (irrecv.decode(&results)) { // Waiting for decoding //Serial.println(results.value); // Print out the decoded results velocita = 0; if (results.value == ir_zero) { Serial.println("ZERO"); velocita = 0; } else if (results.value == ir_uno) { Serial.println("UNO"); velocita = round(255 * 0.1); // velocità 0-255 } else if (results.value == ir_due) { Serial.println("DUE"); velocita = round(255 * 0.2); // velocità 0-255 } else if (results.value == ir_tre) { Serial.println("TRE"); velocita = round(255 * 0.3); // velocità 0-255 } else if (results.value == ir_quattro) { Serial.println("QUATTRO"); velocita = round(255 * 0.4); // velocità 0-255 } else if (results.value == ir_cinque) { Serial.println("CINQUE"); } else if (results.value == ir_sei) { Serial.println("CINQUE"); } irrecv.resume(); // Receive the next value } delay(100); }