
Lab06
main.cpp@0:ce53f232e21b, 2015-11-07 (annotated)
- Committer:
- Juhal
- Date:
- Sat Nov 07 16:07:31 2015 +0000
- Revision:
- 0:ce53f232e21b
Lab06
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Juhal | 0:ce53f232e21b | 1 | #include "mbed.h" |
Juhal | 0:ce53f232e21b | 2 | |
Juhal | 0:ce53f232e21b | 3 | DigitalOut Vcc(PA_0); |
Juhal | 0:ce53f232e21b | 4 | AnalogIn aInn(PA_1); |
Juhal | 0:ce53f232e21b | 5 | DigitalOut Gnd(PA_4); |
Juhal | 0:ce53f232e21b | 6 | |
Juhal | 0:ce53f232e21b | 7 | |
Juhal | 0:ce53f232e21b | 8 | int main() { |
Juhal | 0:ce53f232e21b | 9 | |
Juhal | 0:ce53f232e21b | 10 | Vcc=1; |
Juhal | 0:ce53f232e21b | 11 | Gnd=0; |
Juhal | 0:ce53f232e21b | 12 | |
Juhal | 0:ce53f232e21b | 13 | while(1) |
Juhal | 0:ce53f232e21b | 14 | { |
Juhal | 0:ce53f232e21b | 15 | float voltage = aInn.read()*3.3f; |
Juhal | 0:ce53f232e21b | 16 | printf("Voltage: %.3f \r\n",voltage); |
Juhal | 0:ce53f232e21b | 17 | wait_ms(135); |
Juhal | 0:ce53f232e21b | 18 | } |
Juhal | 0:ce53f232e21b | 19 | } |