by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
main.cpp@0:8e159b6a1d6a, 2012-10-15 (annotated)
- Committer:
- robt
- Date:
- Mon Oct 15 21:16:20 2012 +0000
- Revision:
- 0:8e159b6a1d6a
by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
robt | 0:8e159b6a1d6a | 1 | /*Program Example 5.1: Uses analog input to control LED brightness, through DAC output |
robt | 0:8e159b6a1d6a | 2 | */ |
robt | 0:8e159b6a1d6a | 3 | #include "mbed.h" |
robt | 0:8e159b6a1d6a | 4 | AnalogOut Aout(p18); //defines analog output on Pin 18 |
robt | 0:8e159b6a1d6a | 5 | AnalogIn Ain(p20); //defines analog input on Pin 20 |
robt | 0:8e159b6a1d6a | 6 | |
robt | 0:8e159b6a1d6a | 7 | int main() { |
robt | 0:8e159b6a1d6a | 8 | while(1) { |
robt | 0:8e159b6a1d6a | 9 | Aout=Ain; //transfer analog in value to analog out, both are type float |
robt | 0:8e159b6a1d6a | 10 | } |
robt | 0:8e159b6a1d6a | 11 | } |
robt | 0:8e159b6a1d6a | 12 |