Day 6 – Lost in Space

Photoresistor

With light, there is less resistance

Without light, there is more resistance

High resistance, semi-conductor material. When light hits the device it absorbs the light photons; this process provides energy to the electrons

Analog signals

Continuous signals

Digital signals

Discrete, and in one of two states – 0 or 1 (LOW or HIGH)

HERO Board

A0 – Analog Pin

Arduino Serial Monitor

Window where software can talk to microcontroller

Establish a serial communication connection between IDE and Board

Then, Tools, Serial Monitor (in IDE) to view the data from the board (Photoresistor output)

analogRead ();

Allows HERO board to read analog signals

Measure voltage from 0V to 1023 (5V)

We are “reading” information from photoresistors and “writing” to devices like LEDs

Posted in Uncategorized | Leave a comment

Day 4 – Lost in Space

PinMode (in Setup):

-Switches – input

-LEDs – output

// #define CABIN_LIGHTS_PIN 10 // pin controlling the cabin lights
// #define STORAGE_LIGHTS_PIN 11 // pin controlling the storage lights
// #define COCKPIT_LIGHTS_PIN 12 // pin controlling the exterior lights
const byte CABIN_LIGHTS_PIN = 10; // pin controlling the cabin lights
const byte STORAGE_LIGHTS_PIN = 11; // pin controlling the storage lights
const byte COCKPIT_LIGHTS_PIN = 12; // pin controlling the exterior lights

Note: In past, we used #define to set system-wide variables. Now we’re using const byte.

Const (Constant) – has to remain the same value

Posted in Uncategorized | Leave a comment

Day 3 – Lost in Space

DIP (Dual Inline Package) switch:

3 switches:

-On or Off

-1 or 0

-True or False

-Yes or No

Conditional Logic:

-IF (Primary decision making tool in code)

-ELSE IF (Says to move on to the next condition); always follows and IF or another ELSE IF

-ELSE (Runs if all else fails); if nothing else (IF or ELSE IF) to run, do this

Ground or GND:

-Zero voltage reference

-Provides a path for electricity’s return

Voltage or VCC:

-Voltage at the common collector

-The power-supply source; the ‘engine’

Pull down resistor (the second resistor on board):

-Makes sure circuit behaves properly when switch is off

Inputs:

-A message from HERO board

-Something from sensors, buttons, switches

-For this project, the DIP switch is the Input

Outputs:

-Signals sent out from HERO board

-Could be triggered by code conditions or other sensor readings

-For this project, the LED is the output

Working with DIP switch for project:

-When DIP Switch = ON, ‘DigitalWrite’ is executed, turning LED ‘ON’ or ‘HIGH’

-When DIP Switch = OFF, the ‘else’ block is executed instead, grounding the LED circuit

= or == signs:

= is for assignment

== is for comparison

Posted in Microcontrollers | Tagged , | Leave a comment