Week 3 Lab

Revision as of 22:04, 12 April 2009 by Rtwomey (talk | contribs) (Analog Input)

Revision as of 22:04, 12 April 2009 by Rtwomey (talk | contribs) (Analog Input)

Analog Input

  • File->Sketchbook->Analog->AnalogInput

 val = analogRead(potPin);    // read the value from the sensor

  • Potentiometer

Pot in.png

  • Q: What will the voltage at A_IN be? What are the upper and lower values?
  • Q: Looking at the Arduino help for the analogRead() function, what will the value val be for those highest and lowest voltages?
  • photoresistor from your 147A kit... 160k - ~10k (depending on your lighting conditions).
  • Q: With the same 10k resistor from the schematic above, what range of voltages (and corresponding data values) would you expect to see with this?
  • Q: How could we verify this?
  • 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