Buttons There are two buttons on the board, called button_a and button_b. Attributes button_a A Button instance representing the left button. button_b A Button instance representing the right button. Classes …
-
-
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 …
-
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 …
-
Here we show you how to create a custom image on the led matrix, we use the Mu editor [codesyntax lang=”python”] from microbit import * im = Image(‘99999:90009:90009:90009:99999:’) display.show(im) [/codesyntax] …
-
The MCP9808 digital temperature sensor converts temperatures between -20°C and +100°C to a digital word with ±0.5°C (max.) accuracy. The MCP9808 comes with user-programmable registers that provide flexibility for temperature …
-
The HDC1000 is a digital humidity sensor with integrated temperature sensor that provides excellent measurement accuracy at very low power. The device measures humidity based on a novel capacitive sensor. …
-
The BME280 is a humidity sensor features an extremely fast response time which supports performance requirements for emerging applications such as context awareness, and high accuracy over a wide temperature range. …
-
In this example we use the DHT22 (or AM2302) humidity/temperature sensor and the Arduino UNO board to read data and print it out to the serial monitor. The DHT22 is better …