University of Plymouth - Stages 1, 2 and 3
/
Task411-FZ429
Updated task for the FZ429ZI board
Fork of Task411 by
Diff: main.cpp
- Revision:
- 0:b2188dcbd1b1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Sep 24 12:28:07 2015 +0000 @@ -0,0 +1,28 @@ +#include "mbed.h" + +//Global objects +BusOut binaryOutput(D5, D6, D7); //Outputs as an integer + +DigitalIn SW1(D3); +DigitalIn SW2(D4); + +AnalogIn AIN(A0); +float fVin = 0.0; + +//Main function +int main() { + + + while(1) { + + //Read ADC + fVin = AIN; + + //Write to terminal + printf("Analog input = %6.4f\n", fVin); //3 decimal places, fieldwidth=5 + + //Wait + wait(0.5); + + } //end while(1) +} //end main \ No newline at end of file