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