Well, that's easy.
const byte buttonPin = 1;
const byte moveForwardPin = 2;
void setup() {
pinMode(buttonPin, INPUT_PULLUP);
pinMode(moveForwardPin, OUTPUT);
digitalWrite(moveForwardPin, LOW);
}
void loop() {
if (digitalRead(buttonPin) == LOW) {
digitalWrite (moveForwardPin, HIGH);
}
}
Assumptions made:
Button is wired between GND and pin 1.
Pin 2 set HIGH makes the robot move forward.
With those assumptions, what this code does: the moment you press the button the robot starts moving forward. That's it.