In this segment we will learn to use Object Oriented (OO) Programming. OO is a great way to generate well-structured Arduino sketches with a minimum of programming bugs. Furthermore, objects are a nice way to share code for the operation of standard hardware devices (LCD, ICs etc...) connected to the Arduino.

Goals:

Understand the concept of Object Oriented Programming

Use objects to control digital pins

In-Class Project (and probably homework):

Translate the push button binary counter sketch into an OO sketch using a class.

Call the class "BinaryCounter"

The 'methods' of this class should be:

void BinaryCounter::countUP(); this is supposed to increase the counter by +1.

void BinaryCounter::countDOWN() (this is supposed to decrease the counter by -1.

void BinaryCounter::turnDisplayOff() (this is supposed to turn all the LEDs off, that the display appears dark).

void BinaryCounter::setValue(byte number) (this is supposed to set the counter to a specific state

byte BinaryCounter::getValue() (this is supposed to return the current value of the counter)