SelbstTest

Dependencies:   mbed

Revision:
0:72dad5aac6be
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 15 18:04:43 2018 +0000
@@ -0,0 +1,70 @@
+//Reads input through the ADC, and transfers to PC terminal
+#include "mbed.h"
+#include "C12832.h"
+
+C12832 lcd(p5, p7, p6, p8, p11);
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+DigitalOut led3(LED3);
+DigitalOut led4(LED4);
+
+
+AnalogIn Ain(p20);
+float ADCdata;
+float light;
+
+void Led1()
+{
+
+    if(ADCdata < 0.2)
+        led1 = !led1;
+
+}
+
+void Led2()
+{
+
+    if(ADCdata > 0.2 && ADCdata <=0.4)
+        led2 = !led2;
+
+}
+
+void Led3()
+{
+
+    if(ADCdata > 0.4 && ADCdata <=0.8)
+        led3 = !led3;
+
+}
+
+void Led4()
+{
+
+    if(ADCdata > 0.8 && ADCdata <=1.0)
+        led4 = !led4;
+
+}
+
+
+int main()
+{
+
+
+
+    lcd.cls();      // löscht lcd (clear screen)
+    lcd.locate(0,0);
+    lcd.printf("ADC Data Values... \n\r");
+
+    while (1) {
+        Led1();
+        Led2();
+        Led3();
+        Led4();
+
+        ADCdata=Ain;
+        lcd.locate(0,10);
+        lcd.printf("%f \n\r",ADCdata);
+        wait (0.5);
+    }
+}
\ No newline at end of file