[Noisebridge-discuss] gchat/aim Arduino buddy?

jim jim at systemateka.com
Fri Nov 12 16:43:16 UTC 2010


   i used to teach programming. my favorite language is 
assembler, i've got a good take on C, i've taught basic, 
pascal, cobol, python, perl.... i think i can pretty 
quickly present the basic ideas, and i'd love to see what 
the arduino is about. 
   my time is flexible. i prefer early mornings but for 
this i can probably meet at some time that works for both 
of us, if you wish. 

   briefly (examples at bottom): 
* there's you and there's the machine. 
* the machine needs machine code. 
* you have to write some text that follows the rules of a
  programming language, which could be assembly language 
  or C or whatever you choose (assuming the tools are 
  available for you to use). 
* after you write the text in a file, you have to use a 
  program that reads the text you wrote and creates the 
  machine language the machine needs. that program is 
  called an assembler or a compiler, and it creates a new 
  file with the machine code in it. 
* then your job is to get the file with the machine language 
  from your computer to the machine (the arduino board). 

   as to programming, a programming language is a set of 
keywords and operators and rules for using them. 
   keywords for most languages include "if", "for", "while", 
and probably about 30 more. 
   operators include "+", "-", "&&", and about 40 or 50 
more. 
   there's the notion of an "expression"; the definition 
i like is "a combination of one or more operands and zero 
or more operators". this combination of operands and 
operators has to follow the rules for operators. an 
expression resolves to a single value. 
   there's the notion of Boolean True and False: for most 
languages, 0 is False and any other value is True. you use 
a Boolean expression as a test to determine what your 
program should do next. 
   there's the notion of a variable, which is an identifier 
(a name you make up) that represents a value of some kind 
that is stored at some place in memory (an address). 
   there's the notion of "value", which is some data of 
some kind, such as 5 or "hi" or an address of some data. 
   there's the notion of comments, which are notes you 
write to yourself about things to fix or add to your 
program. there's a special character called a comment 
delimiter that you use to hide your notes from the 
assembler or compiler. 

   two examples: 
--------------------------
# this is a little comment; this program is "pseudo code", 
# which is a fake programming language that i made up. 

a = 3 
b = 4 
c = 5 
d = a + b 

if d > c  # is d bigger than c? 
   print d 

# generally programmers would recognize two expressions 
# in this program:  a + b  and also  d > c  
# the expression  a + b  resolves to the value 7; the 
# expression  d > c  resolves to True or False, 
# depending on whether  d  is greater than  c (which in 
# this case it is). 
# the result of the if statement is that the program 
# will print  7  on its output device. 
# this program is basically idiotic because all the values 
# are typed in: of course d is greater than c. 
--------------------------

--------------------------
# this program is an improvement over the one above. 

get a 
get b 
c = 5 
d = a + b 
if (d > c) 
   print "D wins!" 

# this program uses the "get" keyword to get numbers 
# from the person using the program when it's running. 
# so  a  and  b  are variables: you can't predict what 
# numbers the user will enter. also  d  is a variable 
# for the same reason. we call  c  a variable, but 
# you're not using it that way, it's just another name 
# for 5. note that  a  and  b  and  c  and  d  are 
# all "identifiers", names you made up in this program 
# to represent numbers. 
# note the parentheses about  d > c are a way of grouping 
# the expression  d > c  as a matter of safe programming 
# (protecting that expression from you in case you come 
# back and make changes). 
# "D wins!" is a string, a set of printable characters 
# that you want to be displayed or saved in a file. 
--------------------------

   there's a lot more to programming, but the above should 
be a pretty good start for a noob. also, there are probably 
things going on in the examples (or in your mind) that i 
didn't explain--it's really hard to explain the most basic 
stuff, especially in writing, because after one has learned 
things, one starts taking them for granted and forgets 
about them. 

jim 



On Thu, 2010-11-11 at 23:17 -0800, meredith scheff wrote:
> Hey everyone, 
> 
> 
> I'm just learning arduino as the first programming language i've ever
> learned. I'm wondering if there's anyone who'd be willing to chat with
> me here and there to help me grok it. I'll try not to be too much of
> an annoying n00b.
> It's mainly I have structure and syntax questions.
> bestest, 
> Meredith
> 
> -- 
> doing stuff and making things
> ---
> "The function of all art ... is an extension of the function of the
> visual brain, to acquire knowledge; ...artists are, in a sense,
> neurologists who study the capacities of the visual brain with
> techniques that are unique to them. ." -Semir Zeki
> 
> _______________________________________________
> Noisebridge-discuss mailing list
> Noisebridge-discuss at lists.noisebridge.net
> https://www.noisebridge.net/mailman/listinfo/noisebridge-discuss




More information about the Noisebridge-discuss mailing list