Open lucianoalvs opened 2 years ago
Concordo!
int RECV_PIN = 11; IRrecv irrecv(RECV_PIN); decode_results results;
void setup() { irrecv.enableIRIn();
pinMode(motor1pin1, OUTPUT); pinMode(motor1pin2, OUTPUT);
pinMode(motor2pin1, OUTPUT); pinMode(motor2pin2, OUTPUT);
pinMode(motor3pin1, OUTPUT); pinMode(motor3pin2, OUTPUT); }
void loop() {
if (irrecv.decode(&results)) { digitalWrite(motor1pin1, LOW); digitalWrite(motor1pin2, HIGH);
digitalWrite(motor2pin1, LOW); digitalWrite(motor2pin2, HIGH);
digitalWrite(motor3pin1, HIGH); digitalWrite(motor3pin2, LOW);
irrecv.resume(); // Receive the next value }
}
include
int RECV_PIN = 11; // define input pin on Arduino IRrecv irrecv(RECV_PIN); decode_results results; // decode_results class is defined in IRremote.h void setup() { Serial.begin(9600); irrecv.enableIRIn(); // Start the receiver } void loop() { if (irrecv.decode(&results)) { Serial.println(results.value, HEX); irrecv.resume(); // Receive the next value } delay (100); // small delay to prevent reading errors }