
make public
Diff: main.cpp
- Revision:
- 0:2703fee61906
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Mar 26 10:17:07 2021 +0000 @@ -0,0 +1,17 @@ +#include "mbed.h" +// Initializes a pin to perform analog input and digital outpuut functions +AnalogIn aInput(p19) // pot 1 on the application board +DigitalOut dOutput(LED1); + +int main(void) { + while(1) { + //test the voltage on the initialized analog pin + // if greater than 0.3 * VCC set the digital pin + // to a logic 1 otherwise set to logic 0 + if (aInput > 0.3f) { + dOutput = 1; + } else { + dOutput = 0; + } + } +}