Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity,...

Post on 24-Dec-2015

218 views 0 download

Tags:

Transcript of Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity,...

Image of Arduino

• Arduino discussion

• Address issues with circuit walk-through– Electricity, Programming, Arduino Concepts

• Work on BeatTable (next week)

Agenda

Why (and why not) Arduino?

• Compare to GoGo Board (class discussion)• Examples• When NOT to use Arduino

Discussion of Common Issues• What is an Arduino pin?• What is the difference between an analog and digital pin?• Voltage, Current, Resistance?

– Resistor with LED• Does it matter which side the resistor is on?• Does it matter which direction the LED/resistor is in?• How does LED work?

– Short circuits– Voltage divider (potentiometer)– Pull-up resistors– Order of operations for assembling circuit?

• Where do I get components? What are datasheets?• What is a serial connection? How does it work?• Extending reach of sensors?• What is inside the motor?

Arduino Pins

• Pins are what connect the code you write to the physical world

• Pins communicate in voltages• When a pin is an input, it reads voltages.

When it is an output, it writes voltages.• So what is the difference between digital and

analog?

Voltage, Current, ResistanceThe Unholy Alliance

V = IR

What does this have to do with our circuit?

Blink Code

List of Analog Pins

• Analog Input– A0 - A5

• Analog Output

What is a Potentiometer?

• Voltage Divider

When R2 = 0 ohms, what is Vout?

When R2 = 3k ohms, what is Vout?

When R2 = 5.6k ohms, what is Vout?

When R2 = 100k ohms, what is Vout?

Change Brightness with Knob

• Without changing the connections, can you make it so turning the knob changes the brightness?– 3 minutes for this

Review of Last Week

10%

20%

30%

30%

10%

Last week

BreadboardResitorsV=IRCircuitsDiscussion

Plan for Today

Pull-Up Resistors

Debugging

Serial Communication

Beat Table

012345

0-15

15-30

30-45

45-60

0-1515-3030-4545-60

Class Exercise

• Make a circuit where pushing the button turns the LED on. Only use one button. Use Pin 2.

• Print the state of the button using Serial.println()

Communication with Processing

• http://bit.ly/arduinoBBA• exampleCode -> serialCallResponseArduino • exampleCode -> serialCallReponseProcessing

Controlling Processing with ArduinoButton to Pin 2, Photoresistor to Pin A1, Potentiometer to Pin A0

Arduino

Processing

How does this work?

Add Controls to the BeatTable or Your TUI

• Code for my example is at– http://bit.ly/arduinoBeatTable

• Try changing the value of the speed variable with a potentiometer or photoresistor