05-01 LEDBrightness
From Manuals
(Difference between revisions)
(Created page with 'This program uses an analog input to control the brightness of an LED through a DAC output. /*Program Example 5.1: Uses analog input to control LED brightness, through DAC outp…') |
|||
| Line 1: | Line 1: | ||
This program uses an analog input to control the brightness of an LED through a DAC output. | 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: | ||
| + | {| border="1" cellpadding="5" cellspacing="2" align="center" style="text-align: center;" | ||
| + | |+ align="bottom"|'''Signals Used and Connector Locations for Example 04-07''' | ||
| + | |'''Signal''' | ||
| + | |'''LPC4330 PIN NAME''' | ||
| + | |'''BAM210E''' | ||
| + | |'''BAM210''' | ||
| + | |'''BAM200E''' | ||
| + | |'''BAM200''' | ||
| + | |'''Used for''' | ||
| + | |- | ||
| + | |PWM1 | ||
| + | |P1_7 | ||
| + | |J9-3 | ||
| + | |J9-3 | ||
| + | |S2-3 | ||
| + | |S2-3 | ||
| + | |Buzzer | ||
| + | |- | ||
| + | |} | ||
| + | |||
| + | The following schematic can be used to build the circuit with a BAM210E or BAM210. | ||
| + | [[Image:BAM210_05_01_SCH.png|center|alt=BAM210|frame|<div align="center">'''Schematic for example 05-01''']] | ||
| + | |||
| + | <div style="text-align: left;"> | ||
/*Program Example 5.1: Uses analog input to control LED brightness, through DAC output | /*Program Example 5.1: Uses analog input to control LED brightness, through DAC output | ||
*/ | */ | ||
| Line 13: | Line 38: | ||
} | } | ||
| + | The following image shows the built circuit on a BAM210E. | ||
[[Image:BAM210_LEDBrightness.jpeg|center|]] | [[Image:BAM210_LEDBrightness.jpeg|center|]] | ||
| - | |||
| - | |||
| - | |||
Revision as of 19:13, 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 |
| PWM1 | P1_7 | J9-3 | J9-3 | S2-3 | S2-3 | Buzzer |
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.


