Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <AFMotor.h>
- #include <IRremote.h>
- int RECV_PIN = 2;
- IRrecv irrecv(RECV_PIN);
- AF_DCMotor motor(3, MOTOR12_1KHZ);
- AF_DCMotor motor2(4, MOTOR12_1KHZ);
- decode_results results;
- void setup() {
- motor.setSpeed(255);
- motor2.setSpeed(255);
- irrecv.enableIRIn();
- }
- void loop() {
- if (irrecv.decode(&results)) {
- if(results.value == 0×6621){
- motor.run(FORWARD);
- motor2.run(FORWARD);
- }
- if(results.value == 0×2621){
- motor.run(BACKWARD);
- motor2.run(BACKWARD);
- }
- if(results.value == 0×5621){
- motor.run(FORWARD);
- motor2.run(BACKWARD);
- }
- if(results.value == 0×1621){
- motor.run(BACKWARD);
- motor2.run(FORWARD);
- }
- irrecv.resume();
- }
- delay(500);
- motor.run(RELEASE);
- motor2.run(RELEASE);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement