Changes

Jump to navigation Jump to search
no edit summary
Line 64: Line 64:  
After getting introduced to some of the basic structures of coding, its important to get to know the integrated development environment, or IDE that the coder will use to edit and compile the written programs. For all Arduino boards, the IDE used is the Arduino IDE, available online at: https://www.arduino.cc/en/software. The following figure guides the users to the basic on the basic options available on the IDE:
 
After getting introduced to some of the basic structures of coding, its important to get to know the integrated development environment, or IDE that the coder will use to edit and compile the written programs. For all Arduino boards, the IDE used is the Arduino IDE, available online at: https://www.arduino.cc/en/software. The following figure guides the users to the basic on the basic options available on the IDE:
   −
[[File:Arduino IDE2.jpg|974x974px]]
+
[[File:Arduino IDE2.jpg|930x930px]]
    
====Blink program====
 
====Blink program====
Line 71: Line 71:  
The following provides an overview of the different functions used in this program:
 
The following provides an overview of the different functions used in this program:
 
[[File:Blink program overview.jpg|center|frameless|800x800px]]
 
[[File:Blink program overview.jpg|center|frameless|800x800px]]
 +
{| class="wikitable"
 +
|+Table 2: Overview of functions used in the Blink program
 +
!Function
 +
!Description
 +
|-
 +
|Setup()
 +
|Performs any actions that are initially required to run the rest of the program, such as initializing any peripheral components and setting the communication frequency between the Arduino and the PC.
 +
|-
 +
|Loop()
 +
|The loop function acts as the program's driver, it runs on a continuous loop and specifies the order of operation the microcontroller will perform. Execution starts at the top, goes through the contents of the loop and then starts executing from the top again. This procedure is repeated forever.
 +
|-
 +
|pinMode (pin number, INPUT or Output)
 +
|Configures the pin to behave as either an INPUT or an OUTPUT.
 +
|-
 +
|digitalWrite (pin number, HIGH or LOW)
 +
|Writes a HIGH or LOW value to a digital pin. If the pin has been configured as an OUTPUT, then the signal sent over (ie the voltage) will be set as 5 V (HIGH), or 0 V (LOW). For 3.3 V output boards, the high value will be set to 3.3 V, whereas the low is the same as the 5V board, which is 0V.
 +
|-
 +
|Delay (time in milliseconds)
 +
|Pauses the program for the amount of time specified in the parameter.
 +
|}
    
==Basic Understanding of Programming==
 
==Basic Understanding of Programming==
Line 79: Line 99:  
Some other basic considerations:
 
Some other basic considerations:
 
{| class="wikitable"
 
{| class="wikitable"
|+Table 2: Overview of some basic elements of programming
+
|+Table 3: Overview of some basic elements of programming
 
!
 
!
 
!Symbol
 
!Symbol
Line 101: Line 121:  
Variables allow  information in programmers to be stored or changed within the code. In order to create a variable within your program, it must be declared. To declare a variable, the coder has to write the type of variable to be declared first. Different types exist, most commonly used are:
 
Variables allow  information in programmers to be stored or changed within the code. In order to create a variable within your program, it must be declared. To declare a variable, the coder has to write the type of variable to be declared first. Different types exist, most commonly used are:
 
{| class="wikitable"
 
{| class="wikitable"
|+Table 3: Summary of commonly used variable types
+
|+Table 4: Summary of commonly used variable types
 
!Type
 
!Type
 
!Syntax
 
!Syntax
Line 140: Line 160:     
  .....// some lines of code}
 
  .....// some lines of code}
  −
  −
  −
  −
  −
  −
<br />
  −
  −
  −
<br />
  −
{| class="wikitable"
  −
|+Table 4: Overview of functions used in the Blink program
  −
!Function
  −
!Description
  −
|-
  −
|Setup()
  −
|Performs any actions that are initially required to run the rest of the program, such as initializing any peripheral components and setting the communication frequency between the Arduino and the PC.
  −
|-
  −
|Loop()
  −
|The loop function acts as the program's driver, it runs on a continuous loop and specifies the order of operation the microcontroller will perform. Execution starts at the top, goes through the contents of the loop and then starts executing from the top again. This procedure is repeated forever.
  −
|-
  −
|pinMode (pin number, INPUT or Output)
  −
|Configures the pin to behave as either an INPUT or an OUTPUT.
  −
|-
  −
|digitalWrite (pin number, HIGH or LOW)
  −
|Writes a HIGH or LOW value to a digital pin. If the pin has been configured as an OUTPUT, then the signal sent over (ie the voltage) will be set as 5 V (HIGH), or 0 V (LOW). For 3.3 V output boards, the high value will be set to 3.3 V, whereas the low is the same as the 5V board, which is 0V.
  −
|-
  −
|Delay (time in milliseconds)
  −
|Pauses the program for the amount of time specified in the parameter.
  −
|}
  −
   
===Conditionals===
 
===Conditionals===
 
Conditional statements are programming operations that tells the computer to perform an action for a certain set of conditions. An "if" statement is the most common, and tells the computer to perform a set of actions only if the condition is fullfilled. The syntax is the followoing:
 
Conditional statements are programming operations that tells the computer to perform an action for a certain set of conditions. An "if" statement is the most common, and tells the computer to perform a set of actions only if the condition is fullfilled. The syntax is the followoing:
MakerRepo Staff, MakerRepo Volunteers
240

edits

Navigation menu