Blogger

Delete comment from: Ken Shirriff's blog

Ema said...

I am not sure how to explain it.
I made a picture with that button.
http://s28.postimg.org/7xtv7r565/asdasfasdadf.jpg
On the robot is a button, and when I press it, then it starts to execute the program. When I press it again, it stopps.
If i connect the robot to PC, and i do not press the button, then the program shows me all the buttons that i press from remote control. When I press that button (I guess power on) then my program shows me different codes.
I can save those code too, but sometimes I recieve more than 10 different codes per button.

This is not the only issue.
If I upload my program, then the robot doesnt go forward; it goes back, left and right.
I checked the code, but I can't find the problem, and when I don't use this program, my robot goes forward. I can't figure out why it doesnt't go forward with the IR program.
this is the code for back/on/left/right

int MOTOR2_PIN1=3;
int MOTOR2_PIN2=5;
int MOTOR1_PIN1=6;
int MOTOR1_PIN2=9;

void setup()
{

pinMode (MOTOR1_PIN1, OUTPUT);
pinMode (MOTOR1_PIN2, OUTPUT);
pinMode (MOTOR2_PIN1, OUTPUT);
pinMode (MOTOR2_PIN2, OUTPUT);
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
Serial.println("Ready to move: ");
}


//....
void back(int viteza) // înapoi
{
analogWrite (MOTOR1_PIN1, 0);
analogWrite (MOTOR1_PIN2, viteza);
analogWrite (MOTOR2_PIN1, 0);
analogWrite (MOTOR2_PIN2, viteza);
}

void forward(int viteza) // înainte
{
analogWrite (MOTOR1_PIN1, viteza);
analogWrite (MOTOR1_PIN2, 0);
analogWrite (MOTOR2_PIN1, viteza);
analogWrite (MOTOR2_PIN2, 0);
}

void ok() //stop
{
digitalWrite (MOTOR1_PIN1, LOW);
digitalWrite (MOTOR1_PIN2, LOW);
digitalWrite (MOTOR2_PIN1, LOW);
digitalWrite (MOTOR2_PIN2, LOW);
}


I'm using same code with this loop:
void loop()
{
forward(150);
delay(2000);
back(150);
delay(2000);
ok();
delay(2000);
}

And it goes normaly forward, but with the IR program,when I press forward button it goes to right .Or if i copy the loop code to my IR program, it still goes to right,instead of going forward.

Feb 28, 2014, 3:22:44 PM


Posted to A Multi-Protocol Infrared Remote Library for the Arduino

Google apps
Main menu