Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Arduino introduction

Introducing the important of programming world
explain simple as possible c++ for beginner
Getting Started with Arduino world

  • Login to see the comments

Arduino introduction

  1. 1. Digital Signal Processors General-purpose Microprocessors Microcontrollers Microprocessors 8086, Pentium I-IV, Core-duo, Atom, Sparc,.. 8051, PIC, ATMEGA, AVR,.. TMS320XX AD21XX,… Type of Microprocessors
  2. 2. WHAT IS ARDUINO?
  3. 3. Why invented the Arduino boards ?
  4. 4. Arduino shield
  5. 5. GSM shield Arduino
  6. 6. GPS shield Arduino
  7. 7. Programming
  8. 8. Sketches
  9. 9. ? ? ? ? ? ? ? ? ? ?
  10. 10. Important notes { } curly braces Curly braces (also referred to as just "braces" or "curly brackets") define the beginning and end of function blocks and statement blocks such as the void loop() function and the for and if statements. Void Loop() { Statements; }
  11. 11. ; semicolon A semicolon must be used to end a statement and separate elements of the program. A semicolon is also used to separate elements in a for loop. int x = 13; // declares variable 'x' as the integer 13 /*… */ block comments Block comments, or multi-line comments, are areas of text ignored by the program and are used for large text descriptions of code or comments that help others understand parts of the program. They begin with /* and end with */ and can span multiple lines. /* this is an enclosed block comment don’t forget the closing comment - they have to be balanced! /*
  12. 12. // line comments Single line comments begin with // and end with the next line of code. Like block comments, they are ignored by the program and take no memory space. // this is a single line comment Single line comments are often used after a valid statement to provide more information about what the statement accomplishes or to provide a future reminder.
  13. 13. boolean (0, 1, false, true) char (e.g. ‘a’ -128 to 127) unsigned char (0 to 255) byte (0 to 255) int (-32,768 to 32,767) unsigned int (0 to 65535) word (0 to 65535) long (-2,147,483,648 to 2,147,483,648 unsigned long (0 to 4,294,967,295) float (-3.4028235E+38 to 3.4028235E+38) double (currently same as float) sizeof(myint) // returns 2 bytes
  14. 14. General Operators = (assignment operator) + (addition) - (subtraction) (multiplication) * / (division) % (modulo) == (equal to) != (not equal to) < (less than) > (greater than) <= (less than or equal to) >= (greater than or equal to) && (and) || (or) ! (not)
  15. 15. x ++ // same as x = x + 1, or increments x by +1 x -- // same as x = x - 1, or decrements x by -1 x += y // same as x = x + y, or increments x by +y x -= y // same as x = x - y, or decrements x by -y x *= y // same as x = x * y, or multiplies x by y x /= y // same as x = x / y, or divides x by y
  16. 16. Lecture 2
  17. 17. Important notes { } curly braces Define the beginning and end of function blocks and statement blocks such as the void loop() function and the for and if statements. Void Loop() { Statement; Statement; }
  18. 18. ; semicolon A semicolon must be used to end a statement and separate elements of the program. A semicolon is also used to separate elements in a for loop. int x = 13; // declares variable 'x' as the integer 13 /*… */ block comments Block comments, or multi-line comments, are areas of text ignored by the program and are used for large text descriptions of code or comments that help others understand parts of the program. They begin with /* and end with */ and can span multiple lines. /* this is an enclosed block comment don’t forget the closing comment - they have to be balanced! /*
  19. 19. // line comments Single line comments begin with // and end with the next line of code. Like block comments, they are ignored by the program and take no memory space. // this is a single line comment Single line comments are often used after a valid statement to provide more information about what the statement accomplishes or to provide a future reminder.
  20. 20. boolean (0, 1, false, true) char (e.g. ‘a’ -128 to 127) unsigned char (0 to 255) byte (0 to 255) int (-32,768 to 32,767) unsigned int (0 to 65535) word (0 to 65535) long (-2,147,483,648 to 2,147,483,648 unsigned long (0 to 4,294,967,295) float (-3.4028235E+38 to 3.4028235E+38) double (currently same as float) sizeof(myint) // returns 2 bytes
  21. 21. General Operators = (assignment operator) + (addition) - (subtraction) (multiplication) * / (division) % (modulo) == (equal to) != (not equal to) < (less than) > (greater than) <= (less than or equal to) >= (greater than or equal to) && (and) || (or) ! (not)
  22. 22. Code Structures
  23. 23. Control statements • If statement • Switch case statement • While statement • Do …. While statement • For statement
  24. 24. • If statement • Switch case statement • While statement • Do …. While statement • For statement
  25. 25. If statement One way selection Example If (score >= 60) grade = ‘P’ ; else grade = ‘F’ ; Example Two way selection Multiple selections Example
  26. 26. Important notes { } curly braces Define the beginning and end of function blocks and statement blocks such as the void loop() function and the for and if statements. Void Loop() { Statement; Statement; }
  27. 27. Compound statement (block of statements): if (age > 18) { cout << "Eligible to vote." << endl; cout << "No longer a minor." << endl; } else { cout << "Not eligible to vote." << endl; cout << "Still a minor." << endl; } Example
  28. 28. Switch case statement switch structure Example
  29. 29. • If statement • Switch case statement • While statement • Do …. While statement • For statement
  30. 30. Example • while Looping (Repetition) • do…while Looping (Repetition) Structure (continued) Example
  31. 31. For statement
  32. 32. Infinite loop using while and for for (;;) cout << "Hello" << endl; While(1) {cout << "Hello" << endl;}

×