Changes

m
no edit summary
Line 72: Line 72:       −
When beginning you journey in learning how to code, its important to get to know the integrated development environment, or IDE that the coder will use to edit and compile the written programs. The following figure guides the users to the basic on the basic options available on the IDE:
+
 
 +
When beginning your journey in learning how to code, its important to get to know the integrated development environment, or IDE that the coder will use to edit and compile the written programs. The following figure guides the users on the basic options available on the IDE:
    
[[File:Arduino IDE2.jpg|930x930px]]
 
[[File:Arduino IDE2.jpg|930x930px]]
Line 82: Line 83:       −
In this module we won’t be using complex or external libraries! But keep this in mind for the following ones as this will be necessary later on.
+
In beginner topics we won’t be using complex or external libraries! But keep this in mind for the following ones as this will be necessary later on.
    
==== Built-in Libraries ====
 
==== Built-in Libraries ====
Line 90: Line 91:  
''<u>Where to find them?</u>''
 
''<u>Where to find them?</u>''
   −
There are a few ways to looks for what built-in libraries are available, you can do a quick search in different online Arduino forums, or the easiest way is to look at the library manager in the Arduino IDE. This window displays libraries that are already installed and you also have the ability to install libraries that would would like.
+
There are a few ways to look at what built-in libraries are available, you can do a quick search in different online Arduino forums, or the easiest way is to look at the library manager in the Arduino IDE. This window displays libraries that are already installed and you also have the ability to install new libraries that would would like.
 
+
As seen below, in the menu bar at the top of the window click on ''Tools > Manage Libraries...'' [[File:Library Dropdown.jpg|none|thumb|627x627px]]Inside the manager as seen below you are able to select the type of library you are looking for, for example, installed, etc.[[File:Manage libraries.png|thumb|alt=|none|783x783px]]
 
  −
As seen below, in the menu bar at the top of the window click on ''Tools > Manage Libraries...'' [[File:Library Dropdown.jpg|none|thumb|627x627px]]Inside the manager as seen below you are able to select the type of library you are looking for, for example, installed, arduino and etc.[[File:Manage libraries.png|thumb|alt=|none|783x783px]]
        Line 103: Line 102:       −
The serial monitor is located in two locations: the bar at the top of the IDE, as seen in the figure below.
+
The serial monitor can be accessed in two locations: the icon in the bar at the top of the IDE, as seen in the figure below.
 
[[File:Serial MOnitor 2.png|center|thumb|667x667px]]
 
[[File:Serial MOnitor 2.png|center|thumb|667x667px]]
   Line 113: Line 112:  
A few features to note is the baud rate and auto scroll functionality. The baud rate must match the one dictated in the program, this value dictates that rate that the Arduino and IDE communicate with each other.  
 
A few features to note is the baud rate and auto scroll functionality. The baud rate must match the one dictated in the program, this value dictates that rate that the Arduino and IDE communicate with each other.  
 
   
 
   
[[File:Tempsnip.png|center|thumb|808x808px]]When using the serial monitor it must be initialized for a specific baud rate as follows:
+
[[File:Tempsnip.png|center|thumb|808x808px]]When using the serial monitor it must be initialized in the code for a specific baud rate as follows:
 
  Void Setup {
 
  Void Setup {
   Line 136: Line 135:     
=== Blink program: An Example ===
 
=== Blink program: An Example ===
The Arduino IDE provides creators with a plethora of written programs that are fully ready to run on an Arduino board. They are located in the Files>Examples folder. Amongst the most basic is the "Blink" program, which can be used to not only get to know the basic features in the software and the hardware, but are also a great way to test the connectivity between the Arduino board and the user's computer. This program is located in Files>Examples>01.Basics>Blink.  
+
The Arduino IDE provides creators with a plethora of written programs that are fully ready to run on an Arduino board. They are located in the Files>Examples folder. Among the most basic is the "Blink" program, which can be used to not only get to know the basic features in the software and the hardware, but are also a great way to test the connectivity between the Arduino board and the user's computer. This program is located in Files>Examples>01.Basics>Blink.  
    
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:
Line 195: Line 194:  
|This character ends a program statement and lets the compiler know ‘the end of the current line/statement’
 
|This character ends a program statement and lets the compiler know ‘the end of the current line/statement’
 
|}
 
|}
It is also important to be aware that the Arduino editor is case sensitive, meaning that the words “DOOR” and “Door” are not understood to be the same word by the compiler. Furthermore, to make writing and editing code more friendly, the Arduino IDE will color code important functions, comments, etc. This will be seen later in this section.   
+
It is also important to be aware that the Arduino editor is case sensitive, meaning that the words “DOOR” and “Door” are not understood to be the same word by the compiler. Furthermore, to make writing and editing code more friendly, the Arduino IDE will colour code important functions, comments, etc. This will be seen later in this section.   
   −
As seen below, certain preexisting functions in the Arduino IDE will often times be a certain color. This is a good indicator of if whether or not you have written the function correctly.  
+
As seen below, certain preexisting functions in the Arduino IDE will often times be a certain colour. This is a good indicator of if whether or not you have written the function correctly.  
 
[[File:IDEAFS.png|center|thumb|587x587px|Cited from: https://en.wikipedia.org/wiki/File:Arduino_IDE_-_Blink.png]]
 
[[File:IDEAFS.png|center|thumb|587x587px|Cited from: https://en.wikipedia.org/wiki/File:Arduino_IDE_-_Blink.png]]
   Line 224: Line 223:  
|double or float
 
|double or float
 
|-
 
|-
|charecters
+
|characters
 
|char
 
|char
 
|}
 
|}
After declaring the variable type, the coder must then name the variable. The variable name should clearly reflect the purpose of the value, so that the coder and the reader can easily identify which value is associated with what variable. Additionally, variables cannot have spaces imbedded within the name. For example, "My deposit" is not a valid variable name, but "MyDeposit" is. Note that capitalizations can be useful for readability. Furthermore, variables should not start with digits, or with an underscore "_".
+
After declaring the variable type, the coder must then name the variable. The variable name should clearly reflect the purpose of the value, so that the coder and the reader can easily identify which value is associated with what variable. Additionally, variables cannot have spaces embedded within the name. For example, "My deposit" is not a valid variable name, but "MyDeposit" is. Note that capitalization can be useful for readability. Furthermore, variables should not start with digits, or with an underscore "_".
   −
After naming the variable, the coder can choose to initialize the variable, which is choosing an initial value to be assosiated with the variable (which can change throughout the program). Be careful to stay consistent with the type of the variable. For example, you cannot initialize the variable int Age with a value of "k", as "k" is not an integer. The code segments below illustrate the process of initialization:
+
After naming the variable, the coder can choose to initialize the variable, which is choosing an initial value to be associated with the variable (which can change throughout the program). Be careful to stay consistent with the type of the variable. For example, you cannot initialize the variable int Age with a value of "k", as "k" is not an integer. The code segments below illustrate the process of initialization:
 
  int a;// not initialized, which is ok!
 
  int a;// not initialized, which is ok!
   Line 284: Line 283:  
There are a few ways to calculate the required values for each component, however one of the basic ways of calculating them is '''Ohm's law'''.
 
There are a few ways to calculate the required values for each component, however one of the basic ways of calculating them is '''Ohm's law'''.
   −
The relationship that represents the relationship between voltage, current, and resistance is ohm’s law, represented by:  
+
The relationship that represents the relationship between voltage, current, and resistance is ohm’s law, represented by: '''V=IR'''. The power source in a circuit determines the voltage supplied and the current available. The connected components will draw current from the power source.  
 
  −
'''V=IR'''. The power source in a circuit determines the voltage supplied and the current available. The connected components will draw current from the power source.
      
There are three arrangements of circuits, series, parallel, and combination.  
 
There are three arrangements of circuits, series, parallel, and combination.  
Line 302: Line 299:  
<youtube>F_vLWkkOETI</youtube>
 
<youtube>F_vLWkkOETI</youtube>
   −
=== Breadboard ===
+
=== Introduction to Electronic Components ===
 +
 
 +
==== Breadboard ====
 
A breadboard is used to prototype a temporary circuit. The user can build, test and analyze a circuit without any permanent connections. It is made up of terminal strips and power rails. The terminal strips are used to hold any number of components in place and make electrical connections in a horizontal row. The power rails are the long vertical strips and are used to facilitate power (+) and ground (-) connections by placing them all in one column.
 
A breadboard is used to prototype a temporary circuit. The user can build, test and analyze a circuit without any permanent connections. It is made up of terminal strips and power rails. The terminal strips are used to hold any number of components in place and make electrical connections in a horizontal row. The power rails are the long vertical strips and are used to facilitate power (+) and ground (-) connections by placing them all in one column.
 
[[File:BB-2.png|center|thumb|682x682px|Connections inside a breadboard (Source: https://dreyfuzz.github.io/hackinghardware/)]]
 
[[File:BB-2.png|center|thumb|682x682px|Connections inside a breadboard (Source: https://dreyfuzz.github.io/hackinghardware/)]]
== Introduction to Electronic Components ==
+
==== LED ====
 
+
A Light Emitting Diode, or LED, is a semiconductor device that lights up when an electric current passes through it. They come in many different colours and shapes, and are very versatile. LEDs are diodes, which means that current flows through the element in only one way, from the positive to the negative end. On an LED, the cathode end can be identified by either a flat edge on the body, or as the shorter leg. As such, the anode is the other end (the longer leg on the LED).
===LED===
  −
A Light Emitting Diode, or LED, is a semiconductor device that lights up when an electric current passes through it. They come in many different colors and shapes, and are very versatile. LEDs are diodes, which means that current flows through the element in only one way, from the positive to the negative end. On an LED, the cathode end can be identified by either a flat edge on the body, or as the shorter leg. As such, the anode is the other end (the longer leg on the LED)
   
[[File:LED - 1.png|center|thumb|198x198px|(Source: https://create.arduino.cc/projecthub/rowan07/make-a-simple-led-circuit-ce8308)]]
 
[[File:LED - 1.png|center|thumb|198x198px|(Source: https://create.arduino.cc/projecthub/rowan07/make-a-simple-led-circuit-ce8308)]]
   −
===Pushbutton===
+
====Pushbutton====
 
A pushbutton is an electronic switch component that completes the circuit only when pressed. In an electric circuit, electricity needs to flow continuously through the circuit in order for all parts to function. The pushbutton interrupts this circuit and forms a gap, so that electricity doesn't flow to the other side of the pushbutton. When the pushbutton is pressed. a small spring is activated that is made of conducting material so that electricity flows through the spring to the other side of the pushbutton.
 
A pushbutton is an electronic switch component that completes the circuit only when pressed. In an electric circuit, electricity needs to flow continuously through the circuit in order for all parts to function. The pushbutton interrupts this circuit and forms a gap, so that electricity doesn't flow to the other side of the pushbutton. When the pushbutton is pressed. a small spring is activated that is made of conducting material so that electricity flows through the spring to the other side of the pushbutton.
 
[[File:Pushb.png|center|thumb|(Source: https://www.sparkfun.com/products/9190)]]
 
[[File:Pushb.png|center|thumb|(Source: https://www.sparkfun.com/products/9190)]]
   −
===Resistor===
+
====Resistor====
A resistor is an electrical component which creates electrical impedance, or resistance to current flow. The amount of resistance a resistor provides can be read from the bands of color on the resistor, which are read left to right. For four bands resistors, the first and second bands represent digits, while the third band represents a multiplier to multiply the digits of the first and second band by. The fourth band is the tolerance, it represents how much the resistor may deviate from the value indicated by the bands. The value of the resistor can also be determined using the ohmic function of a multimeter. Resistors are often used in series with components to reduce the amount of current flowing through a circuit, often to protect components rated for lower current amounts. Pull-up and pull-down resistors are used to bias an input on the Arduino to be either HIGH or LOW respectively. This needs to be done as the resting level of the input isn’t necessarily 0. This is especially useful when working with sensors that have an analog output.
+
A resistor is an electrical component which creates electrical impedance, or resistance to current flow. The amount of resistance a resistor provides can be read from the bands of colour on the resistor, which are read left to right. For four bands resistors, the first and second bands represent digits, while the third band represents a multiplier to multiply the digits of the first and second band by. The fourth band is the tolerance, it represents how much the resistor may deviate from the value indicated by the bands. The value of the resistor can also be determined using the ohmic function of a multimeter.  
 +
 
 +
Resistors are often used in series with components to reduce the amount of current flowing through a circuit, often to protect components rated for lower current amounts. Pull-up and pull-down resistors are used to bias an input on the Arduino to be either HIGH or LOW respectively. This needs to be done as the resting level of the input isn’t necessarily 0. This is especially useful when working with sensors that have an analog output.
 
[[File:Resistor 1.png|left|thumb|(Source: https://www.autodesk.com/products/fusion-360/blog/how-to-choose-the-right-resistor/)]]
 
[[File:Resistor 1.png|left|thumb|(Source: https://www.autodesk.com/products/fusion-360/blog/how-to-choose-the-right-resistor/)]]
 
[[File:Bands.png|none|thumb|453x453px|How to read a resistor. (Source: https://www.arrow.com/en/research-and-events/articles/resistor-color-code)]]
 
[[File:Bands.png|none|thumb|453x453px|How to read a resistor. (Source: https://www.arrow.com/en/research-and-events/articles/resistor-color-code)]]
   −
===Introduction to Sensors===
+
==Introduction to Sensors==
Sensors enable the microcontroller to sense the surrounding environment. Many sensors exist on the marker, including but not limited to buttons, temperature sensors, pressure sensors, photoresistors, humidity and moisture, and many more. The output of the sensor (a voltage) changes based on the measured environment properties, and sends that signal over to the Arduino board.                         
+
Sensors enable the microcontroller to sense the surrounding environment. Many sensors exist on the market, including but not limited to buttons, temperature sensors, pressure sensors, photoresistors, humidity and moisture, and many more. The output of the sensor (a voltage) changes based on the measured environment properties, and sends that signal over to the Arduino board.                       
 +
 
 +
Different sensors will use different voltage levels and different methods of communication with microcontrollers. It is always important to read their datasheet and make sure they are compatible with your system before continuing or design your system around the sensor specifications.                         
    
[[File:Sensors1.png|center|frame|(Source: https://www.electronicshub.org/different-types-sensors/)]]             
 
[[File:Sensors1.png|center|frame|(Source: https://www.electronicshub.org/different-types-sensors/)]]             
    
== Online Simulators ==
 
== Online Simulators ==
  −
===Tinkercad: Arduino===
   
Tinkercad is an online platform that enables users to virtually model 3D designs and circuits. Its user friendly interface and functionality encourages students and hobbyists to investigate the functionality of the Arduino boards virtually, as well as start building their designs. To sign up, create an account on: https://www.tinkercad.com, or alternatively, login with google, facebook etc…  
 
Tinkercad is an online platform that enables users to virtually model 3D designs and circuits. Its user friendly interface and functionality encourages students and hobbyists to investigate the functionality of the Arduino boards virtually, as well as start building their designs. To sign up, create an account on: https://www.tinkercad.com, or alternatively, login with google, facebook etc…  
  
MakerRepo Administrators, MakerRepo Staff
756

edits