This is an old revision of the document!
−Table of Contents
Analog Output
there are two means to create analog output. One is through a digital to analog (D/A) converter, while the other is through a high frequency digital signal. The latter method is called pulse width modulation (PWM). One form of PWM involves modulating a digital signal at a certain (high) frequency with a variable duty cycle. If the duty cycle is 0%, then the signal is always off. If the duty cycle is 100%, then it is always on. If it is at 50%, then it is a pulse train whose frequency is that of the signal. Specialized, interrupt-driven, code is required to get PWM working on microprocessors. Fortunately, today, that code is already written in a library to be used.
Arduino
to be added.
TI
to be added.
mBed
p15 to p20 are the AnalogIn Input Pins, and p21 to p26 are the PwmOut Output Pins. This means the mBed can handle separate instances of Analog I/O devices.
This tutorial about connecting pushbuttons to a RGB LED will help.
mBed expresses its analog values from 0.0 to 1.0, floating values. If a more traditional range is preferred, there is always the option of mapping them with simple math.