#include <IRremote.h>
const int RECV_PIN = 2;
IRrecv irrecv(RECV_PIN);
decode_results results;
void setup() {
irrecv.enableIRIn();
pinMode(3, OUTPUT);
pinMode(5, OUTPUT);
}
void loop() {
if (irrecv.decode(&results)) {
if (results.value == 0xFF30CF) {
executeActions();
}
irrecv.resume();
}
}
void moveForward(int speed, int duration) {
analogWrite(3, speed);
analogWrite(5, speed);
delay(duration);
analogWrite(3, 0);
analogWrite(5, 0);
}
void turnRight(int speed, int duration) {
analogWrite(3, speed);
analogWrite(5, 0);
delay(duration);
analogWrite(3, 0);
analogWrite(5, 0);
}
void turnLeft(int speed, int duration) {
analogWrite(3, 0);
analogWrite(5, speed);
delay(duration);
analogWrite(3, 0);
analogWrite(5, 0);
}
void executeActions() {
moveForward(255, 4000);
delay(500);
turnRight(255, 700);
delay(500);
moveForward(255, 2000);
delay(500);
turnLeft(255, 1400);
delay(500);
moveForward(255, 4000);
I loaded this code into the robot(Smart Robot Car v4.0) and it crashed. After loading it only the right side is spinning. How can I load the default settings into it? The manuals are too obscure.