mbed-os
Fork of mbed-os by
features/unsupported/tests/benchmarks/all/main.cpp@1:3deb71413561, 2017-07-20 (annotated)
- Committer:
- xuaner
- Date:
- Thu Jul 20 14:26:57 2017 +0000
- Revision:
- 1:3deb71413561
- Parent:
- 0:f269e3021894
mbed_os
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
elessair | 0:f269e3021894 | 1 | #include "mbed.h" |
elessair | 0:f269e3021894 | 2 | |
elessair | 0:f269e3021894 | 3 | DigitalOut out(p5); |
elessair | 0:f269e3021894 | 4 | #if defined(TARGET_LPC1114) |
elessair | 0:f269e3021894 | 5 | AnalogIn in(p20); |
elessair | 0:f269e3021894 | 6 | #else |
elessair | 0:f269e3021894 | 7 | AnalogIn in(p19); |
elessair | 0:f269e3021894 | 8 | #endif |
elessair | 0:f269e3021894 | 9 | |
elessair | 0:f269e3021894 | 10 | volatile float w, x, y, z; |
elessair | 0:f269e3021894 | 11 | int main() { |
elessair | 0:f269e3021894 | 12 | while(1) { |
elessair | 0:f269e3021894 | 13 | z = x * y / w; |
elessair | 0:f269e3021894 | 14 | printf("Hello World %d %f\n", out.read(), z); |
elessair | 0:f269e3021894 | 15 | if(in > 0.5) { |
elessair | 0:f269e3021894 | 16 | out = !out; |
elessair | 0:f269e3021894 | 17 | } |
elessair | 0:f269e3021894 | 18 | } |
elessair | 0:f269e3021894 | 19 | } |