
Hi Sean, here are some responses (I won’t say answers!) to your notes:
- “if #include then no semi-colon” – yes, this is a quirk of the programming language syntax. Anything with a # is an instruction to the compiler and not actually code. In this case, it means literally take everything from the library “Servo.h” and put it at the top of this file. Why this does not need a ; is a design choice by the creators of c.
- Servo myServo – yes this could be any name, you are labelling a variable so you can reference it later. Which is why it’s a good idea to label it something to do with its purpose!
- Why not const int? – const int would work. Which way round is better is a Swiftian debate amongst coders. I prefer it as it is in the book as it means the types line up during the declarations. (Code is meant to be readable vertically as well as horizontally, which is why we use fonts that line up the letters – monospaced)
- Baud – is how many times a second we want to send/receive messages from the serial object (important for some sensor feedback, e.g. audio)
- Serial – as you say one of the main uses is to send things to the computer so we can see how our code is doing during run time, but there are other things which talk to the Arduino through the serial object, e.g. some complicated sensors.