roach:
Sorry, I'm using the wrong terms here. I don't mean "communicating", like in Serial comms, but more like sending a control signal. All servos I've seen use PWM to communicate the desired "position" of the servo (see [[here](http://www.robotstore.com/download/Servo_Motor_Timing_1.pdf)). The ultrasonic rangefinder sold [[here](http://www.sparkfun.com/commerce/product_info.php?products_id=639) on Sparkfun also outputs data in PWM, as do the [[ADXL accelerometers](http://www.sparkfun.com/commerce/product_info.php?products_id=647), while the [[Dual H-Bridge controller](http://www.sparkfun.com/commerce/product_info.php?products_id=318) takes PWM as a control signal (closer to what you're describing).leon_heller:
PWM is normally used for controlling power, not for communicating data.Anyways, the point of all this is how to output a PWM signal from an AVR, and how to “read” a PWM signal. I’ve seen code examples that use Timer1 (for 10-bit PWM) or Timer0 (for 8-bit). But it’s really all gibberish to me. Was wondering if anyone had some newbie-type code examples.
I see. Define "easy".[/quote]Some AVRs have PWM modules, they are quite easy to use.
Easy if you have some experience of writing microcontroller software.
Getting data from an accelerometer isn’t hard, you just measure the pulse width with a timer.
Leon](http://www.sparkfun.com/commerce/product_info.php?products_id=318)](http://www.sparkfun.com/commerce/product_info.php?products_id=647)](http://www.sparkfun.com/commerce/product_info.php?products_id=639)](http://www.robotstore.com/download/Servo_Motor_Timing_1.pdf)