d

Dependencies:   mbed

Lab2_2.cpp

Committer:
cha45689
Date:
2016-10-31
Revision:
0:1de11c7b1807

File content as of revision 0:1de11c7b1807:


#include "mbed.h"
 
AnalogIn analog_value(A2);
DigitalOut i(D10);
BusOut leds(D2, D3, D4, D5);
BusOut leds1(D6, D7, D8, D9);
int main() {
    while(1) {
        double meas = analog_value.read(); // Converts and read the analog input value (value from 0.0 to 1.0)
        printf ("\n%f",meas);
        meas = meas * 33; // Change the value to be in the 0 to 3300 range
        int b=meas;
        int c = b % 10;
        int d = b % 100 - c;
        leds=c;
        leds1=d/10;
        i=1;
        
    }
}
// When the board read data on analog value to over 3.3 v., There will be error