Unit A · From blocks to text
What we are making: nothing. Today you break things on purpose and learn to read what the computer says back.
Part 2 of 7
Blocks only fitted one way. Text does not, so from now on you will get errors — and so does everybody, including people who have done this for twenty years. The difference is only how fast they read one.
Part 3 of 7
An Arduino error looks like this. It is not a sentence, it is four pieces of information.
Part 4 of 7
Start from your working Session 1 program. Break one thing, compile, read, fix. Then the next.
| Break it like this | It says | Which means |
|---|---|---|
| Take a semicolon off the end of a line | expected ';' before 'delay' | Look at the line above the one it names |
digitalWrite → digitalwrite | not declared in this scope | I have never heard of that word. Nearly always a capital letter |
Delete the last } in the file | expected } at end of input | A bracket is missing somewhere. Count them |
Three breaks. Do them one at a time and fix each before the next.
Part 5 of 7
Now a game. Your teacher will give each team three broken programs. Fix all three. Time it.
Part 6 of 7
As a class, collect the errors that actually came up today and write them on a poster, in your own words. It stays on the wall all year, and it will be the thing you reach for most.
| What you see | Why | What to do |
|---|---|---|
| expected ';' before ... | Missing semicolon. | Look at the line ABOVE the one named. |
| was not declared in this scope | Spelling, or a capital letter. | Check the exact spelling. digitalWrite, not Digitalwrite. |
| expected } at end of input | A curly bracket is missing. | Count your { and }. There must be the same number of each. |
| stray '\' in program | A wrong character, often a smart quote from copying. | Retype the line by hand. |
| Port not found / upload failed | Not a code error at all. | Check board, port and cable. |
Part 7 of 7
In this session