Download presentation
Presentation is loading. Please wait.
Published byLaurel Ryan Modified over 9 years ago
1
Servo Control Using Analog Signal Obtain “analog” input using analogRead().
2
Conversion of Analog to Digital Obtain “analog” input using analogRead(). analogRead() returns a value between 0 (if pin at ground) and 1023 (if pin at 3.3 V). Argument of analogRead() is the pin to read (only pins labeled ANALOG IN can be used).
3
Pulse Width Modulation (PWM)
4
100%
5
Pulse Width Modulation (PWM) 0% On the chipKIT there are 490 periods per second. Use analogWrite(pin, value) to control the duty cycle on a pin. The value must be between 0 and 255. The pin must be one of the underlined pins.
6
Pulse Width Modulation (PWM) If you take the average value over one period, you can think of the voltage as being between 0 V (0% duty cycle) and 3.3 V (100% duty cycle). There are 256 different voltage levels. Can demonstrate this with an LED attached to pin 9 and the example sketch Fading.
7
Pulse Width Modulation (PWM) Upload example sketch Fading for this circuit.
8
Pulse Width Modulation (PWM) Write sketch led_with_potentiometer for this circuit.
9
Pulse Width Modulation (PWM) Write sketch led_with_inc_and_dec for this circuit.
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.