Docsity

Arduino Programming: Comments, Operators, Variables, and Control Structures, Slides of Electronics

Partial preview of the text

Download Arduino Programming: Comments, Operators, Variables, and Control Structures and more Slides Electronics in PDF only on Docsity!

Arduino Programming Section http://arduino.cc/en/Reference/HomePage

The Arduino Environment

Serial Port / COM Port

The Environment

Comments

  • (^) Comments can be anywhere

Comments

  • (^) Comments can be anywhere
  • (^) Comments created with // or /* and */

Comments

  • (^) Comments can be anywhere
  • (^) Comments created with // or /* and */
  • (^) Comments do not affect code
  • (^) You may not need comments, but think about the community!

Operators

The equals sign = is used to assign a value == is used to compare values

Variables

Basic variable types: Boolean Integer Character

Declaring Variables

Boolean: boolean variableName;

Declaring Variables

Boolean: boolean variableName; Integer: int variableName; Character: char variableName;

Declaring Variables

Boolean: boolean variableName; Integer: int variableName; Character: char variableName; String: stringName [ ];

Assigning Variables

Boolean: variableName = true; or variableName = false; Integer: variableName = 32767; or variableName = -32768;

Assigning Variables

Boolean: variableName = true; or variableName = false; Integer: variableName = 32767; or variableName = -32768; Character: variableName = ‘A’; or stringName = “SparkFun”;