Bertie Harte
/
ADCImplementation
make public
Revision 0:2703fee61906, committed 2021-03-26
- Comitter:
- BertieHarte
- Date:
- Fri Mar 26 10:17:07 2021 +0000
- Commit message:
- make public
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 2703fee61906 main.cpp --- /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; + } + } +}
diff -r 000000000000 -r 2703fee61906 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Fri Mar 26 10:17:07 2021 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400 \ No newline at end of file