if (x=5 && y=10) {....
This if statement will run it[ch700]s code only if x is 5 and
also y is 10.
|| means true if either operand is true, e.g. :
if (x=5 || y=10) {.....
This will run if x is 5 or if y is 10.
The ! or NOT statement means true if the operand is
false, e.g. :
if (!x) {.......
Will run if x is false, i.e. equals zero.
You can also [ch699]nest[ch700] conditions with parenthesis, for
example
if (x=5 && (y=10 || z=25)) {.......
Thank you very much for putting this together and making it available.
I've been using Arduino for a number of years but I think I'll still find your guide very useful. In particular, I like the fact that you've taken the time to explain the code in small parts.
Drat. I bought the Getting Started book, but yours is much better. I especially like that you spend time explaining how to determine resistor values. And explaining the need for protective parts, like diodes. The Make book gives the impression that all you need is big box of 10k resistors.
Errata: Project 1. The resistor is 150 ohm at the start of the project (parts image & text, p. 19), but becomes a 220 ohm at the end (parts image & text, p.23). The paragraph at the bottom of page 23 calculates that we need a 150 ohm resistor, but after the chart the first paragraph (page 24) says we need a 220 ohm resistor. The image shows a 220 ohm resistor
Finally, unless my eyes are deceiving me, the wiring schematic image (p.19) shows a 1000 ohm resistor.
I appreciate that you tell the reader to always wire a resistor in series with an LED -- I didn't get that from the equivalent section in the Make book. In fact, they put the LED across pin 13 and the gnd, giving the impression that resistors were optional.
Wiring diagram on page 19 seems to be still showing a 1000 ohm resistor, though that could be my poor, sad eyes.
Page 30 the parts list calls for 220 ohm resistors, but text and wiring diagram indicate 150 ohm.
Am I correct to assume that wherever an LED connects directly there should be a 150 ohm resistor? Or are there some LED's that require a different size resistor?
By the way, the only reason I'm finding these potential problems is because you've created a document that's fun to read!