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

25
Image of Arduino

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

Page 1: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

Image of Arduino

Page 2: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

• Arduino discussion

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

• Work on BeatTable (next week)

Agenda

Page 3: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

Why (and why not) Arduino?

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

Page 4: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

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?

Page 5: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)
Page 6: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)
Page 7: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

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?

Page 8: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

Voltage, Current, ResistanceThe Unholy Alliance

Page 9: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

V = IR

What does this have to do with our circuit?

Page 10: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

Blink Code

Page 11: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)
Page 12: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)
Page 13: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

List of Analog Pins

• Analog Input– A0 - A5

• Analog Output

Page 14: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

What is a Potentiometer?

• Voltage Divider

Page 15: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

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?

Page 16: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

Change Brightness with Knob

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

Page 17: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

Review of Last Week

10%

20%

30%

30%

10%

Last week

BreadboardResitorsV=IRCircuitsDiscussion

Page 18: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

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

Page 19: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

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()

Page 20: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)
Page 21: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

Communication with Processing

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

Page 22: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

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

Page 23: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

Arduino

Processing

Page 24: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

How does this work?

Page 25: Image of Arduino. Arduino discussion Address issues with circuit walk-through – Electricity, Programming, Arduino Concepts Work on BeatTable (next week)

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