Basic control loop

Here's the code we used in the lab today.