Samuel Rusterholz
/
PM2_Example_IRSensor
Workshop 1
Diff: main.cpp
- Revision:
- 11:cfc9b8e963db
- Parent:
- 10:f459b443f676
- Child:
- 13:5d689f89d794
diff -r f459b443f676 -r cfc9b8e963db main.cpp --- a/main.cpp Sat Mar 13 17:37:03 2021 +0100 +++ b/main.cpp Sat Mar 13 17:37:49 2021 +0100 @@ -14,8 +14,7 @@ void button_rise(); /* input your stuff here */ -AnalogIn analogIn(PA_0); -float dist = 0.0f; + int main() { @@ -30,12 +29,9 @@ /* ------------- start hacking ------------- -------------*/ if(executeMainTask) { - - dist = analogIn.read()*3.3f; + - /* do only output what's really necessary, outputting "Measured value in mV: "" within the loop is no good solution */ - printf("Measured value in mV: %d\r\n", (static_cast<int>(dist * 1e3))); - + /* visual feedback that the main task is executed */ led = !led;