Introducing 

Prezi AI.

Your new presentation assistant.

Refine, enhance, and tailor your content, source relevant images, and edit visuals quicker than ever before.

Loading…
Transcript

Circuits & Parametric Design

SEATING CHART

Please find your seat and take out a writing utensil and notebook.

SEATING CHART

Do Now (Answer in your notes):

Look closely at the code on the right.

How do you think you could use the serial readout to control an actuator? In other words, what code would you add to this code to use Photoresistors voltage readings to turn an LED On or OFF?

int sensorPin = A0;

int sensorValue = 0;

void setup()

{

//Setup a connection for serial communication

// between the Arduino and computer

Serial.begin(9600);

Serial.println("Getting started...");

}

void loop()

{

sensorValue = analogRead(sensorPin);

Serial.println(sensorValue);

delay(50);

}

Do Now

Today's Agenda

today's Agenda

  • Part 1: Mini-lesson: Mappings (5 min)
  • Part 2: Arduino Sketch - Photoresistors Due today (34 min)

Lesson Objective

Lesson Objective

I can collect information from a sensor in an arduino circuit.

Mastery Skills

  • MS 1D: Given a CAD tool, I can operate and identify appropriate uses of that tool.
  • MS 3A: Given a problem, I can create a function-contract that performs an operation that will solve that problem.

Arduino Unit - Section 2: Sensors

Sensors!

  • Devices that convert other forms of energy (mechanical, light, etc...) into electrical energy.
  • Use input pins to detect changes in electrical energy.

Section 2 Goals

  • Review Helpful Resources for Arduino Fans
  • Learn how to collect measurements (signals) from sensors, including:
  • Push Button, Photoresistor (LDR), Force- Sensitive Resistor (FSR), and Potentiometer (Pot)
  • Use measurements from a sensor to control and actuator (Simple System)
  • Gain experience using these functions:
  • digitalRead( ), analogRead( ), Serial.println( )

Helpful Resources - as you work in class or at home

  • Common Functions for Arduinos Chart: https://www.teachengineering.org/content/nyu_/activities/nyu_physical_computing/nyu_physical_computing_activity1_common_functions_v2_tedl.pdf
  • Arduino Programming Notebook (SWN): https://playground.arduino.cc/uploads/Main/arduino_notebook_v1-1.pdf
  • Arduino Reference Page: https://www.arduino.cc/reference/en/
  • Google to search for Arduino Help
  • Getting Started with Arduino (PDF book)
  • Learn Electronics with Arduino (PDF book)

Arduino Unit Section 2: Sensors

The Serial Monitor!

Can we use Digital Pins if we want to measure voltages BETWEEN 0V and 5V?

A window that allows us to observe the Arduino communicating with the computer.

Mappings

Defined: A mapping links the Range of one set of data to the Range of another.

Does this sounds familiar?

"... a function is a relation between a set of inputs and a set of permissible outputs with the property that each input is related to exactly one output."

Mappings

Look closely at this circuit. What is being "linked" here?

Re-maps a number from one range to another.

map();

map(value, inputLow, inputHigh, outputLow (or High), outputHigh (or Low))

Example:

map();

int val = analogRead(A0);

val = map(val, 0, 1023, 0, 255);

analogWrite(9, val);

Arduino: Review

Assignment

Your assignment:

  • Part 1: Wire a circuit that blinks two LEDs On and Off every 1/2 second.
  • Part 2: Wire a circuit that fades an LED from fully off to fully on and back down to fully off over the course of 2.5 seconds.
  • Part 3: Wire a circuit that allows a button to control an LED. When the button is pressed, the LED is on, when the button is released, the LED is off.

PLEASE NOTE: You MUST work with a partner. We will use the driver-navigator protocol. You will switch roles every 8 minutes.

Learn more about creating dynamic, engaging presentations with Prezi