Updated task for the FZ429ZI board

Fork of Task411 by University of Plymouth - Stages 1, 2 and 3

Committer:
noutram
Date:
Thu Jul 13 14:52:05 2017 +0000
Revision:
1:d34891c6377e
Parent:
0:b2188dcbd1b1
updated for mbed-os 5.5

Who changed what in which revision?

UserRevisionLine numberNew contents of line
noutram 0:b2188dcbd1b1 1 #include "mbed.h"
noutram 0:b2188dcbd1b1 2
noutram 0:b2188dcbd1b1 3 //Global objects
noutram 0:b2188dcbd1b1 4 BusOut binaryOutput(D5, D6, D7); //Outputs as an integer
noutram 0:b2188dcbd1b1 5
noutram 0:b2188dcbd1b1 6 DigitalIn SW1(D3);
noutram 0:b2188dcbd1b1 7 DigitalIn SW2(D4);
noutram 0:b2188dcbd1b1 8
noutram 0:b2188dcbd1b1 9 AnalogIn AIN(A0);
noutram 0:b2188dcbd1b1 10 float fVin = 0.0;
noutram 0:b2188dcbd1b1 11
noutram 0:b2188dcbd1b1 12 //Main function
noutram 0:b2188dcbd1b1 13 int main() {
noutram 0:b2188dcbd1b1 14
noutram 0:b2188dcbd1b1 15
noutram 0:b2188dcbd1b1 16 while(1) {
noutram 0:b2188dcbd1b1 17
noutram 0:b2188dcbd1b1 18 //Read ADC
noutram 0:b2188dcbd1b1 19 fVin = AIN;
noutram 0:b2188dcbd1b1 20
noutram 0:b2188dcbd1b1 21 //Write to terminal
noutram 0:b2188dcbd1b1 22 printf("Analog input = %6.4f\n", fVin); //3 decimal places, fieldwidth=5
noutram 0:b2188dcbd1b1 23
noutram 0:b2188dcbd1b1 24 //Wait
noutram 0:b2188dcbd1b1 25 wait(0.5);
noutram 0:b2188dcbd1b1 26
noutram 0:b2188dcbd1b1 27 } //end while(1)
noutram 0:b2188dcbd1b1 28 } //end main