(file: LangRevLEv0a.htm)

What is this?

This is a summary of Stuff You Should Know About. It is a selective copy of the Arduino Language Reference page. As such, it goes along with the choices made by the editors of that page... including "pinMode" in the "functions" part of the page, for instance. (Which makes sense, even if pinMode doesn't return a result. It "belongs" with digitalRead, etc, doesn't it?)

The editors of the page break "everything" into three parts: Functions, Variables and Structure. I'm not convinced that the criteria for what goes in which part are terribly important to someone getting started- i.e. "don't worry about that... there's enough to master"!


Functions are things that "boil down" to a datum.

Digital, analog I/O

pinmode(), digitalRead(), digitalWrite(), analogRead()


delay(), millis()

Random Numbers

random(), randomSeed()



Variables (and constants)===============================

Giving us places to "put things".


The following words are part of the Arduino's vocabulary. Some are only useful in a narrow context. (E.g. INPUT is only used with pinMode). The words, as is usual in the Arduino language, are case sensitive. The list: HIGH, LOW, true, false, OUTPUT, INPUT, INPUT_PULLUP, LED_BUILTIN

Data Types

This section of the reference isn't so much about giving you specific words... although it does give you some. It is about the sorts of data that the Arduino language recognizes.

You've met three so far... but not really had to "understand" them very deeply. They are void, byte, and int. For now, the "big deal" is that (for now) we are SAYING that a variable for the byte data-type can only hold 0-255 (inclusive), and variables for the byte or int data type can only hold integers (whole numbers). (The byte data-type can, in fact, deal with negative numbers, but... (We'll keep that for another time!))

Variable Scope and Qualifiers

const. You probably don't "understand" this deeply, but know a good time and place to use it.

Structure =========================================


loop(), setup()... every "sketch" (what I call a program) has one of each. The stuff in setup() happens once, then the stuff in loop() starts happening over an over. Nothing complex to grasp here.

Control Structure

if, and if... else. Not hard.. but be careful about how much is include in the "then" and "else" parts. It is easy to get that wrong.

do... while

Further syntax

Single line comments. Multi-line comments. Use them.

Semi-colon. It shouldn't be hard. But it often is, for some people. Inside curly braces, one at the end of each statement, including the last. Don't "break" an if... then... else statement in the middle with a semi-colon before the "else". Do not put one at the end of an #include line. (It won't do harm, but your program prbably won't compile, but it might, and behave strangely, and if if won't the error messages will be cryptic!)

Curley braces, i.e. {these things}. They create a statement block... a bunch of statements that "go together". For example the "then" part of an if statement are made "one statement" with curley braces. They also enclose all of the code of a function, e.g. loop().

Arithmetic operators

"Operators" "do things". Sometimes to one number. "Square" is an operator, as in "3 squared is 9". (Arduino doesn't know "square".) Sometimes to two numbers, as in "+" for add, "3+4 is 7". Arduino knows: +, -. It uses * for multiplication. When it divides a byte-type number, it thows away the fraction part ( 7/2=3 !). Also in this group: The equals sign, which has little to do with the mathematical "equals" in the Arduino language. It is the Arduino's "assignment operator", a key, vital element of any language. If you say "x=7", you are saying "Put 7 in the variable nammed 'x'."

Modulo: You haven't met it yet, but it is too cool, and has sundry uses... If you say x=17%5, you will have 2 in x. Modulo (%) divides the first number by the second, the way little kids divide, and gives you for the answer the "remainder" part. What's it good for? That will become apparent when you need it!

Comparison Operators

These are used in the conditions of "if" and "while" statements (and, you'll see, elsewhere). in "if (x>5) {Serial.println("It was greater than 5"); the "x>5" was the condition, and ">" was the conditional operator.

If you want to see if x equals 5, be sure to remember to use "==". The double equals sign is treated as "one symbol"... the conditional operator for "are these two things equal?" (A single equals sign is the "assignment operator" (see above). Using "=" instead of "==" in a condition will not trigger an error message... but your program won't do what you are expecting it to do!

Other conditional operators: != for "not equal to, < for "less than", <= for "less than or equal to", >= for "grater than or equal to"

That's it!

With just what's above, and some help with how to use them, and an understanding of the electronics involved, there is a great deal you can do with an Arduino. Perhaps 80% of all the code I've ever written is made up of the things you see above.

But it's a bit like knowing how to read and write. An eight year old can write... but can he/ she yet write a great novel? An eight year old, who has put in the effort, can play scales nicely on a piano, and certain pieces of music.

But Jane Austen and Georg Handel were eight year olds once, writing eight year old stories and music. And look where they went.

Here is how you can contact this page's author, Tom Boyd.

=== ignore next