Josef Humer
/
0000_CAMPUS_POTI
Analogspannung, Balkenanzeige, Serielle Schnittstelle
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 Serial pc(SERIAL_TX, SERIAL_RX); // TxD, RxD Definition der Portleitung 00003 /* ******************** Variablendefinitionen ***************************** */ 00004 00005 AnalogIn poti(A3); 00006 00007 float analogwert; 00008 BusOut vpoti(D2,D3,D6,D9,D11,D12,A6,D13); 00009 00010 int main() 00011 { pc.baud(9600); 00012 while(1) 00013 { 00014 pc.printf("Spannung=%fV\n",(poti.read())*3.3); 00015 vpoti=poti.read_u16()>>8; 00016 } 00017 }
Generated on Mon Aug 29 2022 15:46:50 by 1.7.2