Die Steine / Mbed 2 deprecated FototransistorAufgabe2LowVersion

Dependencies:   mbed

Revision:
0:3a42b53185b8
Child:
1:fc8fd0a0c09d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Jan 09 14:59:26 2019 +0000
@@ -0,0 +1,32 @@
+#include "mbed.h"
+
+AnalogIn input(A0);
+Serial pc(SERIAL_TX, SERIAL_RX); 
+
+int main() { 
+
+
+uint16_t inputWert = 0x0000; 
+ 
+
+while (1) {
+
+inputWert = input.read_u16();
+pc.printf("sample value: 0x%04X\n",inputWert);
+
+wait_ms(10);
+
+pc.printf("Spannung\n");
+if(inputWert != 0x0000) {
+  if (inputWert <= 0x5555){
+  pc.printf("<*****            >\n");}
+  if(inputWert >= 0x5555 && inputWert <= 0xAAAA){
+  pc.printf("<***** *****      >\n");}    
+  if(inputWert >= 0xAAAA){
+  pc.printf("<***** ***** *****>\n");}  
+  } else {
+         pc.printf("<                 >\n");}                        
+pc.printf("\n");                        
+//wait_ms(1000);
+}
+}
\ No newline at end of file