Rob Toulson / Mbed 2 deprecated PE_05-01_LEDBrightness

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*Program Example 5.1: Uses analog input to control LED brightness, through DAC output
00002                                                                             */
00003 #include "mbed.h"
00004 AnalogOut Aout(p18);      //defines analog output on Pin 18
00005 AnalogIn Ain(p20);         //defines analog input on Pin 20
00006 
00007 int main() {
00008   while(1) {
00009     Aout=Ain;     //transfer analog in value to analog out, both are type float
00010   }
00011 }
00012