s

Dependencies:   LM75B C12832_lcd LCD_fonts

main.cpp

Committer:
an3
Date:
2020-01-05
Revision:
2:b4a812174f7e
Parent:
1:133129bd3d45
Child:
3:1d052bd266c6

File content as of revision 2:b4a812174f7e:

#include "mbed.h"
#include "LM75B.h"
#include "C12832_lcd.h"


DigitalOut myled(LED2);


Serial pc(USBTX, USBRX);
Thread led_thread;

Mutex verMutex; //Nr.5   weiss nicht wo es bei meiner Variante hinkäme

  char eingabe='5';
  int eingabezahl;// nr.2 hälfte an;hälfte aus
  int zeit_leucht=0.025;
  int zeit_dunkel=0.025;


void ledthreaT()
{
    while(1)
    {
        eingabe = pc.getc();
        pc.printf("Helligkeit: N=0% 1-9(10-90%) F(100%)");
        
        if(eingabe=='N'){
            eingabezahl=0;
        }
         if(eingabe=='F'){
             eingabezahl=10;
        }
        if((eingabe<=9)&&(eingabe>=0)){
            eingabezahl=(int)eingabe;  //
        }
        
        zeit_leucht = (eingabezahl*0.05)/10;
        zeit_dunkel =0.05-zeit_leucht;
    }
    
}
int main()
{
  
  
    
  led_thread.start(ledThread);
    
    
    
    while(1)
    {
        if(eingabe='N'){  //aufgabe 6 grundschulmässig gelöst
        myled=0;
        }
        else{
        myled=1; 
        wait(zeit_leucht);
        myled=0; 
        wait(zeit_dunkel); 
        }   
    }
    
       
    
}