bionic_arduino_class4.pdf

(6719 KB) Pobierz
741244404 UNPDF
Bionic Arduino
Introduction to Microcontrollers with Arduino
Class 4
20 Nov 2007 - machineproject - Tod E. Kurt
741244404.010.png 741244404.011.png
What’s for Today
Controlling Servos
About the I2C bus
Using I2C on Arduino
About Accelerometers
Nintendo Wii Nunchuck as Input Device
About PWM
741244404.012.png
Recap: Blinky LED
Make sure things still work
compile
upload
Load “File/Sketchbook/Examples/Digital/Blink”
TX/RX flash
b l i n k b l i n k
Change the “delay()” values to change blink rate
sketch runs
741244404.013.png 741244404.001.png 741244404.002.png 741244404.003.png
Pulse Width Modulation
Computers can’t output analog voltages
Only digital voltages (0 volts or 5 volts)
But you can fake it
if you average a digital signal flipping
between two voltages.
For example...
More commonly called “PWM”
741244404.004.png
Output voltage is averaged from on vs. off time
PWM
output_voltage = (on_time / off_time) * max_voltage
5 volts
3.75 Volts
0 volts
75% 25%
75% 25% 75% 25%
5 volts
2.5 Volts
0 volts
50% 50% 50% 50% 50%
50%
5 volts
0 volts
1.0 Volts
20% 80%
20% 80% 20% 80%
741244404.005.png 741244404.006.png 741244404.007.png 741244404.008.png 741244404.009.png
Zgłoś jeśli naruszono regulamin