The Thrill of a Blinking LED

I’m sure to most people a blinking LED is completely mundane. But to me it represents the smallest iota of creation. In computer programming the standard first thing to do in a new language is write a program dubbed “Hello World.” You write a program that prints “hello world” to the screen and as a result learn a few simple commands for a given language. For arduino boards, the equivalent of the Hello World program is the blink program. I just completed my blink program on my new arduino uno:

blinking LED on an arduino

I used to think the Hello World program was just a simple exercise in programming but now I think it is more than that. Its fundamental point is to learn how to make a program that has some kind of output. For the blink program, I find myself staring at a blinking LED and being thrilled with the result. Anyone else who walks by will look at it and literally see nothing. A blinking LED is commonplace and does not capture your attention at all. But in my head I know how its happening, what the mistakes I made along the way were, and what I could try next. I feel delighted in my tiny creation and that made me realize that the Hello World program isn’t about learning simple commands, it’s about learning that you can create. It’s an invitation to experiment and to try new things.

For my next project, I’m going to blink out “Hello World” in Morse Code.

Pong

I’m taking the interactive python course from coursera and we just made Pong. You can check out my version here. I had some fun adding in a few extra things like sound effects and a computer player. It was an interesting figuring out a way to get the computer to play well but not too well. I ended up using four tricks:

  1. The computer only pays attention to the ball when it’s going towards the computer (more human like)
  2. As ball gets closer horizontally the computer is more likely to take an action
  3. The computer is more likely to make a move when the ball is further away vertically
  4. For the higher difficulties the paddle tracks where the ball will be in the future by a few samples (i.e. spotting ahead of the target)

The program compares the distance of the ball to a random number to accomplish the second two. To play it just click the play button in the upper left corner. It works in Chrome but might have issues in IE.

screen shot from pong

My pong game

 

http://www.codeskulptor.org/#user23_C2drLrScJ6_12.py