Day 2 – really dark in here

Breadboard structure (horizontal position):

Bus Strip – running length of blue (negative/ground), red (positive) and then to the other side, running length of blue (negative/ground) and red (positive).

Terminal strip – rows a thru e and f thru j – each strip being five holes connected together

Ravine – means of separating the board in two

LED (Light emitting Diode):

-Only allows current to flow in one direction. Di = two and ode = path.

-Long pin on LED is the anode and is positive

-Other (shorter pin) on LED is the cathode and is negative

Resistor:

-Need to reduce/resist the current passing through, for example, an LED

-The resist the flow of electric current

-Ohms – unit of measurement. The higher the Ohm value, the more the resistance

220 Ohm Resistor:

Variables:

-Can be of different types (Integer, Character, Float)

-Integer (int) – can store whole numbers (eg 1, 5, -42, 0)

-Example of an integer variable – int myVariable = 10

Comments (collapsing):

-Theoretically, I should be able to click to the right of line number, and before first character of comment and a collapse symbol shows – it doesn’t

Include Headers:

-This allows us to include code that has already been programmed, into our code

include “Arduino.h”

Defining variables with DEFINE:

define CABIN_LIGHTS_PIN 12

In this case, we defined a variable CABIN_LIGHTS_PIN to be 12. This variable is not going to change

Pin Mode:

-On HERO board, we can have the pins used for input or output. We define using pinmode

-We enter this within the SETUP function

void setup() {
pinMode(CABIN_LIGHTS_PIN, OUTPUT);

Loop function:

void loop() {
digitalWrite(CABIN_LIGHTS_PIN, HIGH); // This line turns the lander’s light ON.
delay(1000); // Wait for one second (1000 milliseconds) with the light ON.
digitalWrite(CABIN_LIGHTS_PIN, LOW); // This line turns the lander’s light OFF.
delay(100); // Wait for a tenth of a second (100 milliseconds) with the light OFF.
}

Connecting HERO Board to breadboard, including placing resistor and LED:

5 volt pin

Ground pin

Current flows from 5 volt to ground

This entry was posted in Microcontrollers and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.