Computer Controlled Quadruped

Example Description
In this tutorial, you will learn how to control a quadruped robot using the arrow key program.

Introduction

In this example, we will make the computer program that controls a “quadruped” (a four-legged robot). It’s like a remote control car, except with four legs instead of four wheels. You can press different keys on the keyboard to make the quadruped move forward, backward, turn left and turn right.

Logic

The Quadruped will move according to the following logic:

  1. 32Quadruped will move forward when the “UP” key is pressed.
  2. Quadruped will move backward when the “DOWN” key is pressed.
  3. Quadruped will turn left when the “LEFT” key is pressed.
  4. When the “RIGHT” key is pressed – Quadruped will turn right.

Code

The program uses the up, down, left, and right arrows to control the robot and make it move forward, backward, left, and right. Every time you press one of the arrows, Quarky will move in the direction you choose for 1000 steps.

Output

Table of Contents