d
Dependencies: mbed
Diff: Lab2_2.cpp
- Revision:
- 0:1de11c7b1807
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Lab2_2.cpp Mon Oct 31 14:48:31 2016 +0000 @@ -0,0 +1,22 @@ + +#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 \ No newline at end of file