
0508_Assignment2
Dependencies: mbed
main.cpp
- Committer:
- Gennanio
- Date:
- 2015-10-29
- Revision:
- 0:259c510de120
File content as of revision 0:259c510de120:
// 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); } }