SEARCH
TOOLBOX
LANGUAGES
modified on 17 September 2014 at 19:24 ••• 15,629 views

05-01 LEDBrightness

From Manuals

(Difference between revisions)
Jump to: navigation, search
Support (Talk | contribs)
(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…')
Newer edit →

Revision as of 15:21, 14 August 2014

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 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
  }
}


BAM210
Schematic for example 05-01