flexSensor code
Dependencies: Map
Diff: main.cpp
- Revision:
- 0:5f93dfb618bf
diff -r 000000000000 -r 5f93dfb618bf main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jul 19 05:41:58 2019 +0000 @@ -0,0 +1,18 @@ +/* mbed Microcontroller Library + * Copyright (c) 2018 ARM Limited + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "mbed.h" +#include "Map.hpp" + +AnalogIn flexSensor(PA_7); +Map map(0.9, 0.99999999, 0, 10000); +int main() { + while (true) { + float analogValue = flexSensor; + + wait(0.5); + printf("%d\n", (int)map.Calculate(analogValue)); + } +}