Things to remember
The following sections cover some things you need to remember.
Watch your case
C is case sensitive. So, we need to take care about what we type, or our code won't compile. For example, loop()
and Loop()
are not the same thing in C. We cannot use serial.print("Hello Arduino!");
instead of Serial.print("Hello Arduino!");
.
Don't forget your semicolon!
Now look at the following code. Can you tell where it went wrong?
void setup() { Serial.begin(9600) Serial.println("Arduino is fun"); } void loop() { }
Exactly! On the second line, we missed a semicolon. Let's see if our Arduino IDE can detect the error. We wrote the code in the editor of our Arduino IDE and clicked the verify button (), and found the following result:
From this screen, we can see that our Arduino IDE could detect the error. The log (the black portion of the Arduino IDE) shows where the error occurred. The log says,Â
expected ';' before 'Serial...