mBot: Program for remote movement doesn't work properly


#1

I uploaded this program using mBlock to my mBot. The upload was successful. This program is for using the remote control to move the mBot in four directions.

For some reason, the arrow buttons are incorrectly mapped. Here’s what they are doing:
UP - moves mBot left
DOWN - moves mBot right
LEFT - moves mBot forward
RIGHT - moves mBot backward

Here’s the part of the code that controls the movement. This was the output from mBlock. I didn’t paste all of the includes and other stuff.

void loop(){
    
    if(ir.keyPressed(64)){
        motor_9.run(255);
        motor_10.run(255);
    }else{
        if(ir.keyPressed(25)){
            motor_9.run(-255);
            motor_10.run(-255);
        }else{
            if(ir.keyPressed(7)){
                motor_9.run(255);
                motor_10.run(-255);
            }else{
                if(ir.keyPressed(9)){
                    motor_9.run(-255);
                    motor_10.run(255);
                }else{
                    motor_9.run(0);
                    motor_10.run(0);
                }
            }
        }
    }
    ir.loop();
    
    
}

#2

You might have the motor speeds incorrect.
see this post about how to go in each direction