SAMI NAQVI
/
TALab3C_ADC
ECE595 - Lab 3 Part 3 - Analog2Digital - TA
main.cpp@0:f61eba51d14a, 2022-02-06 (annotated)
- Committer:
- naqvis
- Date:
- Sun Feb 06 02:01:18 2022 +0000
- Revision:
- 0:f61eba51d14a
ECE 595;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
naqvis | 0:f61eba51d14a | 1 | #include "mbed.h" |
naqvis | 0:f61eba51d14a | 2 | AnalogIn AnIn(A0); |
naqvis | 0:f61eba51d14a | 3 | DigitalOut led(LED1); |
naqvis | 0:f61eba51d14a | 4 | Serial pc(USBTX,USBRX); |
naqvis | 0:f61eba51d14a | 5 | float x; |
naqvis | 0:f61eba51d14a | 6 | int main() |
naqvis | 0:f61eba51d14a | 7 | { |
naqvis | 0:f61eba51d14a | 8 | pc.printf(" ADC demo code\r\n"); |
naqvis | 0:f61eba51d14a | 9 | while (1) |
naqvis | 0:f61eba51d14a | 10 | { |
naqvis | 0:f61eba51d14a | 11 | x=AnIn.read(); |
naqvis | 0:f61eba51d14a | 12 | pc.printf("ADC0_Ch12=(%d)\r\n", x); |
naqvis | 0:f61eba51d14a | 13 | wait(.2); |
naqvis | 0:f61eba51d14a | 14 | } |
naqvis | 0:f61eba51d14a | 15 | } |