How to Break Out "The Big Six" of Computer Science Concepts

One of the biggest hurdles facing anyone delivering computer science or its associated topics in the classroom is how to break out and deliver the concepts within. SparkFun has wrestled with this almost since its first days. More and more, we each code in the context of physical computing as a hardware company.

 

The Stepped Reckoner, a Gottfried Wilhelm Leibniz joint

 Fortunately, after all this time we have hit on some ways of sorting out and delivering concepts. We've settled on a framework for teaching we call “The Big Six.” The contents have evolved over time and we still accept that the current version may not be the final version, but I will give you my shot at it, nonetheless.

We separate things out as follows:

- Input vs. output

- Digital vs. analog

- Variable types and declaration

- Program flow and logic

- Communication

- Functions, objects and libraries

It is our working assumption that if you master the basics of these in Arduino (or whatever language you choose), then the rest will be fairly self-explanatory. As well, the concepts travel well to other languages, making picking up other programming skillsets much easier.

Digital Output

When we start with Arduino, we start with “Blink,” and this is a fairly well-traveled way to get people started. Blink is, of course, an output.

 

 Wiring for the basic “Blink” sketch

 

Variables

We alter the timing, and sometimes we’ll replace the standard “delay(1000)” with a variable (int delayTime=0;) such as “delay(delayTime),” and then increment the “delayTime” variable with a line like: “delayTime= delayTime +10.”

Analog output

Next, we may switch the digital output from pin 13 to pin 9 and demonstrate analog output. We’ll then start to change the brightness with a variable I like to call...”brightness.”

Program flow and logic

We can set boundaries with an "if" statement and compound logic, and this leads us to a fade program.

Analog input

Very often at this point, we’ll add a potentiometer and link the analogRead of the potentiometer to the output of the LED on pin 9. We show the difference between the 10-bit value of the analogRead command and the 8-bit analogWrite command, and we talk about dividing by four to scale the output to the LED.

Here we also take the opportunity to remove the potentiometer form the breadboard, and we replace it with a light sensor to demonstrate analog sensors.

 

 Wiring for the pot and LED

Libraries

We have covered quite a bit here, but there is more to come. Introducing servos is a great way to talk about libraries and at this point in the progression, we do just that. We do some very basic servo operations, and we quickly move to a project. My colleague Derek loves to build a chicken coop here. We use the servo to open and close the chicken coop door based on the light sensor’s determination on whether it’s dark or light.

The servo library, which comes pre-installed, calls a servo object. There is another important addition: Are the chickens in the coop before you close the door?

Servo wiring example

Digital input

By using a button to detect a chicken on a nest (these are really fat, healthy chickens), we can incorporate digital input into our sketch.

A cool Internet of chickens project!

 This covers the basics and gives a framework for introducing the concepts. Another exploration of this framing can be found in Derek Runberg’s book on Processing. How have you broken out computer science concepts in your classroom?