05-01 LEDBrightness
From Manuals
(Difference between revisions)
| (One intermediate revision not shown) | |||
| Line 3: | Line 3: | ||
The signals used for this example are listed below: | The signals used for this example are listed below: | ||
{| border="1" cellpadding="5" cellspacing="2" align="center" style="text-align: center;" | {| border="1" cellpadding="5" cellspacing="2" align="center" style="text-align: center;" | ||
| - | |+ align="bottom"|'''Signals Used and Connector Locations for Example | + | |+ align="bottom"|'''Signals Used and Connector Locations for Example 05-01''' |
|'''Signal''' | |'''Signal''' | ||
|'''LPC4330 PIN NAME''' | |'''LPC4330 PIN NAME''' | ||
| Line 12: | Line 12: | ||
|'''Used for''' | |'''Used for''' | ||
|- | |- | ||
| - | | | + | |A0 |
| - | | | + | |P7_4 |
| - | | | + | |J8-1 |
| - | | | + | |J8-1 |
| - | | | + | |S4-3 |
| - | | | + | |S4-3 |
| - | | | + | |Potentiometer |
| + | |- | ||
| + | |DAC0 | ||
| + | |P4_4 | ||
| + | |J8-6 | ||
| + | |J8-6 | ||
| + | |S3-5 | ||
| + | |S3-5 | ||
| + | |LED | ||
|- | |- | ||
|} | |} | ||
Current revision as of 19:24, 17 September 2014
This program uses an analog input to control the brightness of an LED through a DAC output.
The signals used for this example are listed below:
| Signal | LPC4330 PIN NAME | BAM210E | BAM210 | BAM200E | BAM200 | Used for |
| A0 | P7_4 | J8-1 | J8-1 | S4-3 | S4-3 | Potentiometer |
| DAC0 | P4_4 | J8-6 | J8-6 | S3-5 | S3-5 | LED |
The following schematic can be used to build the circuit with a BAM210E or BAM210.
/*Program Example 5.1: Uses analog input to control LED brightness, through DAC output
*/
#include "mbed.h"
AnalogOut Aout(DAC0); //defines analog output on Pin DAC0
AnalogIn Ain(A0); //defines analog input on Pin A0
int main() {
while(1) {
Aout=Ain; //transfer analog in value to analog out, both are type float
}
}
The following image shows the built circuit on a BAM210E.


