Today, we will run through the basics of Arduino programming. To follow along, please go to the reference section of the Arduino site and step through the functions as we go.
Also, download the files below. They are the Arduino code examples we'll follow once we start making real circuits.
How do you make learning a language/literacy skill playful?
These are the design challenges I came up with for the Design and Education course. Interesting stuff.
Once again, Kelcey has been tremendously helpful with psychology texts. I've been looking over some of the literature she gave me, and I've found some interesting new facts. One of the key factors in predicting whether students will continue with computer education is whether they feel they have the ability to control the computer. This ability may be pegged to experience, but there is no direct correlation between prior experience and willingness to continue learning about computers. Feelings of comfort in using computers (self-efficacy) are a much better predictor.
This leads me to think that the important part of teaching new students, or students coming from fields not related to computer science, is to give them immediate feelings of control over what the computer does--that this is far more important than having them be competent with computers. The more assured they are that they can overcome a technical obstacle they once thought to be impossible, relative to their ability, the more likely they will be to pursue this work in the future.
Take a peek at the fifth file. All that's been added is a new window title at line 191 ("Lincoln Versus Kitties"), creating a few sound objects starting at line 201, and few calls sprinkled around the file that play those sounds at the right time. I'll leave those for you to discover, but their placement should make sense at this point. Also, note how easy it is to add sound effects here in just a couple of lines!
And that is that... for making space invaders. But what about other games? Using other languages?
First off, the basics are always the same. Collect input. Make decisions. Wipe away the old drawings and paste on some new ones. Repeat.
Fine, fine, there are a couple more things happening in the fourth file.
First, on line 261, we have this line:
player_laser_sprites.add( PlayerLaserSprite( player_sprite.rect.midtop ) )
Wuh? All that does is ask that a new laser sprite be added to the board every time we hit the spacebar. And we ask that it appear in the area of the player_sprite... at the middle top of it, to be exact. Once we've added the sprite, it just goes, passed on its own rules established in "update." Bang!
If you look in the update function for the EnemyClass, you'll see that is does the exact same thing for enemy laser blast, except that it does it randomly instead of at every press of the spacebar.
Copyright Mike Edwards 2006-2009. All content available under the Creative Commons Attribution ShareAlike license, unless otherwise noted.