The Arduino IDE
To program your Arduino board you will need the programming software. The Arduino IDE (integrated development environtment). Download at www.arduino.cc
The Programing Structure of an Arduino Sketch
- Variable Declaration Section: In the variable declaration section, usually contains variables that you must declare. To declare is to indicate that something will be used or specified for a particular use. It is like the ingredients in a recipe.
- Setup Section: Here you setup the "actions" of what the program is going to do to make the final product function. This could include describing which pins will be on or off or which mathematical calculations will occur. In a recipe this would be what you would do with the ingredients, like measure, mix and bake.
- Loop Section: The Loop section tells the Arduino to run that set of instructions over and over and makes the final events happen. In a recipe it would be your final product like your cake with the frosting all done.
Computer Science Terms |
Learn more about Arduino C Language (Click on Button)
|
Combining & Adding Code Using Curly Braces (Braces are my Friends)Combining several projects using Curly Braces. Here is a basic combination of three previous basic projects. Combine "Blink" "Buzzer On and Off" and "Simple Servo" code to works simultaneously.
|
Combined Codes
Conditional Statements - If ElseExample of Conditional Statements - IF ELSE
|
Common Errors to watch out for
1. Make sure that you use upper case and lower case the same throughout. For example; if you declare a pin to be called "buzzerPin" then anywhere else you use that phrase the P should be capitalized.
2. Don't forget to check semicolons ; Be sure that semicolons are where they should be.
3. Curly Braces { } Be sure that Curly braces are all correct. Try to balance them as best you can so you don't get any error messages.
4. Make sure that you connect your pin in the correct pin number. Sometimes the numbers for the pins will be different in the code than what is show in the wiring diagram.
2. Don't forget to check semicolons ; Be sure that semicolons are where they should be.
3. Curly Braces { } Be sure that Curly braces are all correct. Try to balance them as best you can so you don't get any error messages.
4. Make sure that you connect your pin in the correct pin number. Sometimes the numbers for the pins will be different in the code than what is show in the wiring diagram.