Difference between revisions of "Week 3 Lab"
From Robert-Depot
(→Analog Input) |
(→Analog Input) |
||
Line 8: | Line 8: | ||
* Potentiometer | * Potentiometer | ||
[[Image:Pot_in.png]] | [[Image:Pot_in.png]] | ||
− | * | + | * Question1: What will the Voltage at V_IN be? What are the upper and lower voltages that will be measured? |
− | + | * Question 2: Looking at the help for the <code>analogRead()</code> function, what will the value <code>val</code> be for those highest and lowest voltages? | |
* photo-resistor | * photo-resistor |
Revision as of 21:52, 12 April 2009
from Electronic Technologies for Art
Contents
Analog Input
- File->Sketchbook->Analog->AnalogInput
val = analogRead(potPin); // read the value from the sensor
- Potentiometer
- Question1: What will the Voltage at V_IN be? What are the upper and lower voltages that will be measured?
- Question 2: Looking at the help for the
analogRead()
function, what will the valueval
be for those highest and lowest voltages?
- photo-resistor
- strain gauge
Analog Output
LED Dimming
- File->Sketchbook->Examples->Analog->Fading
analogWrite(ledpin, value); // sets the value (range from 0 to 255)
PWM (pulse width modulation)
- lights, fading
<youtube v="62gWVWCyw_w" loop="true"/>
Motor Speed Control
- Basic motor control (DC motors) see week 5
Sound, Tone Generation
- sounds, tone generation