make public

Dependencies:   mbed

main.cpp

Committer:
BertieHarte
Date:
2021-03-26
Revision:
0:2703fee61906

File content as of revision 0:2703fee61906:

#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;
        }
    }
}