Automated swinging servo

Following the example we worked on in class today, get your Arduino to:

When coding the above, your code should be clear, but also brief. Don't use more loops or code than you need to. You should do this in its entirety without using any additional loops (like "for" or "while"), i.e., just using the main Arduino loop.

It turns out that there are some detailed rules on the Arduino involving which pins you can use at the same time. We'll talk about them. For the time being, do the following:

Be prepared at the beginning of class on Thursday to show what you've accomplished, and also submit your program here via Moodle.

Human controlled swinging servo (optional)

For a bonus, use a joystick or two buttons to control the Arduino. Be able to move the joystick right (or push one button) to have the LED/servo go in one direction, and move the joystick left (or push the other button) to have the LED/servo go in the other direction.

Similarly, submit your program to Moodle if you did this part, and be prepared to show your results in class.