0508_Assignment2
Dependencies: mbed
Revision 0:259c510de120, committed 2015-10-29
- Comitter:
- Gennanio
- Date:
- Thu Oct 29 09:49:28 2015 +0000
- Commit message:
- 555
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 259c510de120 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Oct 29 09:49:28 2015 +0000 @@ -0,0 +1,40 @@ +// Assignment 2 +// 29/10/2015 +#include "mbed.h" + +Serial BT(D8,D2); //tx rx +BusOut S1(D3,D4,D5,D6),S2(D9,D10,D11,D12); +DigitalOut point(D13); +AnalogIn Vin(A5); +Timer timeout; + +int main() +{ + + point=1; + float v; + uint8_t a[2],counter; + S1=0; + S2=0; + while(true) + { + timeout.reset(); + timeout.start(); + counter = 0; + while ((counter < 2) && (timeout.read() < 1)) + { + if (BT.readable()) + { + a[counter] = BT.getc(); + if(counter) + S2=a[counter]-48; + else + S1=a[counter]-48; + counter++; + //BT.printf("%c",a[counter-1]); + } + } + v=Vin.read()*3.3; + BT.printf("VR = %f\n",v); + } +} \ No newline at end of file
diff -r 000000000000 -r 259c510de120 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Oct 29 09:49:28 2015 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68 \ No newline at end of file