s

Dependencies:   C12832

Revision:
0:921e0ef4606b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Feb 04 09:35:55 2020 +0000
@@ -0,0 +1,70 @@
+#include "mbed.h"
+#include "C12832.h"
+
+Serial pc(USBTX, USBRX); // tx, rx
+DigitalOut led(LED1);
+
+Thread blinky;
+Thread joythread;
+
+PwmOut led1 (LED1);
+DigitalIn down(A3);
+DigitalIn up(A2);
+BusIn joy(p15,p12,p13,p16);
+
+
+unsigned int ton_off = 1000;
+
+void plus100(){
+    ton_off=ton_off+100;
+    if(ton_off<2000){ ton_off=2000; }
+}
+
+void minus100(){
+    ton_off=ton_off-100;
+    if(ton_off<200){ ton_off=200; }
+}
+
+void Joy_of_thread()
+{
+    for(;;)
+    {
+        if(up){
+            plus100();
+            //p15.rise(&plus100);
+            pc.printf("wartezeit zwischen ein-aus:%d",ton_off);
+        }
+        
+        if(down){
+            minus100();
+            //p12.rise(&minus100);
+            pc.printf("wartezeit zwischen ein-aus:%d",ton_off);
+            
+        }
+        thread_sleep_for(10);//fragen sie alle 10ms die tasten ab
+    }
+}
+
+
+void blinky_thread()
+{
+    for(;;)     //wie while(true), es ist aber grad in.
+    {
+        led1=1;
+        thread_sleep_for(ton_off);
+        led1=0;
+        thread_sleep_for(ton_off);
+    }
+}
+    
+int main() 
+{ 
+    blinky.start(blinky_thread);
+    joythread.start(Joy_of_thread);
+    
+    while(1){
+        wait(1);       
+    }
+}        //           Klammern {}              Gross-klein schreibung       while()
+
+