Thursday, January 20, 2011

Project 2 - S.O.S. Morse Code Signaler

Project 2 uses the same circuit from Project 1, just different code. The code on page 32 is fairly easy to follow, but this is the first time I've encountered the shortcut code for incrementing (x++). My past programming languages include BASIC, Fortran, and Pascal... old school, yes. So I understand the theory of loops, conditionals, etc... and the conventions of this new language aren't confusing me (yet).

I entered the code and ran it - video below. Not much here for experimenting and variations other than either changing the code to some other word or changing the flashing speed and delay times. I did try my hand at rewriting the code with the For loop running in reverse... (see screenshot of my modification). Was guessing about the x--, but it worked... I simply changed:

for (int x=0; x<3; x++)

to

for (int x=2; x>-1; x--)

Why did I do this? Just a hunch that it would work the same way, but actually testing it will stick with me more than a simple mind exercise... I'm hoping to find ways to modify other projects as they happen and try and learn a bit about the programming language and/or the Arduino... more to come.



No comments:

Post a Comment