Josef Humer
/
0000_CAMPUS_POTI
Analogspannung, Balkenanzeige, Serielle Schnittstelle
main.cpp@0:cd5a90a3eafd, 2019-11-23 (annotated)
- Committer:
- heseg
- Date:
- Sat Nov 23 07:56:04 2019 +0000
- Revision:
- 0:cd5a90a3eafd
Analogspannung, LED Balkenanzeige, Serielle Schnittstelle
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
heseg | 0:cd5a90a3eafd | 1 | #include "mbed.h" |
heseg | 0:cd5a90a3eafd | 2 | Serial pc(SERIAL_TX, SERIAL_RX); // TxD, RxD Definition der Portleitung |
heseg | 0:cd5a90a3eafd | 3 | /* ******************** Variablendefinitionen ***************************** */ |
heseg | 0:cd5a90a3eafd | 4 | |
heseg | 0:cd5a90a3eafd | 5 | AnalogIn poti(A3); |
heseg | 0:cd5a90a3eafd | 6 | |
heseg | 0:cd5a90a3eafd | 7 | float analogwert; |
heseg | 0:cd5a90a3eafd | 8 | BusOut vpoti(D2,D3,D6,D9,D11,D12,A6,D13); |
heseg | 0:cd5a90a3eafd | 9 | |
heseg | 0:cd5a90a3eafd | 10 | int main() |
heseg | 0:cd5a90a3eafd | 11 | { pc.baud(9600); |
heseg | 0:cd5a90a3eafd | 12 | while(1) |
heseg | 0:cd5a90a3eafd | 13 | { |
heseg | 0:cd5a90a3eafd | 14 | pc.printf("Spannung=%fV\n",(poti.read())*3.3); |
heseg | 0:cd5a90a3eafd | 15 | vpoti=poti.read_u16()>>8; |
heseg | 0:cd5a90a3eafd | 16 | } |
heseg | 0:cd5a90a3eafd | 17 | } |