This is a 50-point project that must be submitted to the Moodle submission page for Project P13 by 2:00 PM on Friday, 2 December. We are going to try to work this in the lab for students who have a working Project 10.
Add an incomplete C++ class Stoplight
in your
Project 10 solution and
use the extended class to simplify (hopefully) your solution.
Go ahead and create an Arduino sketch called
Project13
and cut-and-paste your
Project 10 solution into
your new Arduino sketch.
Go ahead and compile the sketch to make sure this part of the
process has worked well.
Then unzip the two-file ZIP into
your Project13
sketch directory.
You will also need to add the two files to your sketch.
One of these new files will be
Stoplight.h, the
specification for the Stoplight
class.
The other will be
Stoplight. , an
implementation of the Stoplight
class.
With these two files added, compile your sketch and make sure there are no errors.
Modify your sketch so that it uses the Stoplight
class
to control the lights. This may not result in a smaller program,
but it should put you in a classy mood.
Add at least one method to your class. I suggest something
like red2green
which changes a light from red to green.
Of course, other possibility include
green2yellow
and yellow2red
.
The purpose of this assignment is to allow you to say you have dabbled with object-oriented program. That’s all.