WARNING: Preprocessor macros, although tempting, can produce quite unexpected results if not done right. Always keep in mind that macros are textual substitutions done to your source code before anything …
Arduino Basics
-
-
When we create a function, it must be given a name. The naming convention for functions is the same as for variables: •The function name can be made up of …
-
The most basic Arduino sketch consists of two functions called setup() and loop(). The Arduino IDE once installed has a basic example that shows this. Open the Arduino IDE and select …
-
An if statement can be followed by an optional else statement, which executes when the expression is false. Syntax The syntax of an if…else statement is [codesyntax lang=”cpp”] if(expression) { …
-
if, which is used in conjunction with a comparison operator, tests whether a certain condition has been reached, such as an input being above a certain number. If the expression …
-
The do loop works in the same manner as the while loop, with one difference in that the condition is tested at the end of the loop, so the do …
-
while loops will loop continuously, and infinitely, until the expression inside the parenthesis, () becomes false. Something must change the tested variable, or the while loop will never exit. This …
-
Arduino for beginners : for loops The for statement is used to repeat a block of statements enclosed in curly braces. An increment counter is usually used to increment and …
-
In this example we use the RGB led again but are introducing a couple of new programming topis. We introduce the switch case structure and the random and randomSeed functions. …
-
An RGB led is basically 3 LEDs in the one package, a red, green and blue one which either share a common cathode or a common cathode. Using one of …
-
In the last example – http://www.mikroblog.net/arduino/arduino-basics/more-arduino-and-led-examples.php we showed you some examples of flashing multiple LEDs, now this code worked OK but there is a more efficient way of doing the same action. …
-
In the first basic tutorial we showed a couple of simple LED examples, here is another couple to try A reminder of the schematic if you need it …
-
Flashing an LED is one of the most basic projects to get started with when learning about the Arduino platform, in this example we will use 8 LEDs. This is for …