Hello everybody, I want to rotate a one dc motor with ir remote. I want that he rotate clockwise, counter clockwise and he stop when we press three buttons. i've try this programm but when I try ...
nothing
Could somebody can help me ? If you want i can put my schema.
#include <IRremote.h>
const byte IR_RECV_PIN = 10;
const byte MOTOR_D_PIN = 2;
const byte MOTOR_G_PIN = 3;
IRrecv irrecv(IR_RECV_PIN);
decode_results results;
void setup() {
irrecv.enableIRIn();
pinMode(MOTOR_D_PIN, OUTPUT);
pinMode(MOTOR_G_PIN, OUTPUT);
}
void loop () {
if (irrecv.decode(&results)) {
if(results.value == 0x20df609f) {
digitalWrite(MOTOR_D_PIN, LOW);
digitalWrite(MOTOR_G_PIN, HIGH);
} else if (results.value == 0x20dfe01f) {
digitalWrite(MOTOR_D_PIN, HIGH);
digitalWrite(MOTOR_G_PIN, LOW);
} else if(results.value == 0x20df22dd) {
digitalWrite(MOTOR_D_PIN, LOW);
digitalWrite(MOTOR_G_PIN, LOW);
}
irrecv.resume();
}
}