This week, we look at what constitutes syntax in a programming language and how to employ it when writing code in Arduino.
Last week, we examined how a program flows in Arduino. This week, we continue with the computer science theme and look at syntax rules: What do we mean by syntax in programming, and how do we use it when writing for Arduino?
Syntax, as it relates to computer science, is the set of rules for combining words, phrases, numbers and symbols to create correctly structured code in a programming language. In the video, we look at how high-level languages like C and C++ came to be, what makes up identifiers, and some keywords to avoid using as identifiers. We also examine single line (//) and multiple line (/* */) comments and how they can be used to document code.
Many of the reserved keywords and built-in Arduino functions can be found on Arduino’s reference page, which has proven to be an invaluable resource when teaching people the building blocks of Arduino.
If you’re new to Arduino but have some experience programming, this tutorial might be able to shed some light on what this Arduino thing is:
What other computer science concepts would you like to see covered? Please let us know in the comments below.
I’m hoping to cover the basics for students and beginners. Time permitting, I would love to get around to more advanced topics like PWM, interrupts and writing your own Arduino libraries using object-oriented programming.