A simple program that receives a value over analog input and displays it on a terminal.
Dependencies: mbed
main.cpp@0:c033c4dfdf94, 2014-12-18 (annotated)
- Committer:
- tbjazic
- Date:
- Thu Dec 18 09:27:05 2014 +0000
- Revision:
- 0:c033c4dfdf94
Initial commit.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
tbjazic | 0:c033c4dfdf94 | 1 | #include "mbed.h" |
tbjazic | 0:c033c4dfdf94 | 2 | |
tbjazic | 0:c033c4dfdf94 | 3 | AnalogIn in(p17); |
tbjazic | 0:c033c4dfdf94 | 4 | Serial pc(USBTX, USBRX); |
tbjazic | 0:c033c4dfdf94 | 5 | |
tbjazic | 0:c033c4dfdf94 | 6 | int main() { |
tbjazic | 0:c033c4dfdf94 | 7 | float value; |
tbjazic | 0:c033c4dfdf94 | 8 | while(1) { |
tbjazic | 0:c033c4dfdf94 | 9 | value = in; |
tbjazic | 0:c033c4dfdf94 | 10 | pc.printf("\n\rValue received over analog in: %f", value); |
tbjazic | 0:c033c4dfdf94 | 11 | wait(1); |
tbjazic | 0:c033c4dfdf94 | 12 | } |
tbjazic | 0:c033c4dfdf94 | 13 | } |