Weekly Journal (Janosch Spohner)

Feb. 6th – Seven Segment Display and Arrays


We worked with a seven segment display which will display numbers when the lights inside light up in the correct pattern. We also used this exercise as an introduction to arrays. At first we only used an array to store the pin numbers of the seven LED’s.

const int segments[] = {7, 8, 9, 10, 11, 12, 13};

I ended up rewriting the entire sketch with Binary representation of the segments so I could avoid the ten large blocks of code that would have dictated which segments should be on and off in order to create the ten digits. Once I found the base 10 values for the binary representation it was pretty easy to condense the entire program to less than a page. Below is the entire code for the seven segment display with binary representations, notice how the second array makes the code much more simple.

const int segments[] = {7, 8, 9, 10, 11, 12, 13};

void setup() {
  for (int i = 0; i < 7; i++) {
    pinMode(segments[i], OUTPUT);

void loop() {

  for (int i = 0; i < 10; i++) {

void showDigit(int d) {
  int digits[] = {111, 40, 93, 124, 58, 118, 119, 44, 127, 62};
  for (int i = 6; i > -1; i--) {
    digitalWrite(segments[i], bitRead(digits[d], i));


Combination Lock


I also managed to create a very basic combination lock by using the existing code and making a state machine that knew which digit I was pressing the button on. Right now it only works with the combination 123 and you can mess up the combination and it will still work. These are things I hope to change in order make it a little bit more advanced.

Feb. 8th – NeoPixels

We created a template for using NeoPixels so that we are able to easily use them in the future. Once we had our basic template done we figured out how to create a running man effect. The effect was created by having one LED be a different color than the rest, this represented the mans current positions. Then we added two buttons which controlled the direction of the man. When one button was pressed the man moved one direction and when the other was pressed the opposite would happen. Each direction also had a specific color. Below is what this effect looks like.




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s