Fikret Eren
/
M0BOARD_FSST03
x
Fork of M0BOARD_FSST03 by
Diff: main.cpp
- Revision:
- 2:e73e456e0542
- Parent:
- 1:60247c53e9f8
diff -r 60247c53e9f8 -r e73e456e0542 main.cpp --- a/main.cpp Wed Sep 28 08:54:03 2016 +0000 +++ b/main.cpp Wed Oct 05 09:07:22 2016 +0000 @@ -6,43 +6,81 @@ DigitalOut Led4(LED4); Serial fs(USBTX, USBRX); LM75B sensor(p28, p27) ; -char ch; +AnalogIn LDR(p16); +AnalogIn poti(p15); + +void TempMax(); -int main() { - if (sensor.open()) { - fs.printf("Device detected!\r\n"); +int main() +{ + char ch; + + if(sensor.open() != 0) { + fs.printf("Geraet gefunden"); while(1) { - Led4=1; - wait(0.5); - Led4=0; - wait(0.5); - fs.printf("Temperatur =%.3f\n\r",(float)sensor); - wait(0.5); + Led3 = Led4 = 1; + wait(1.5); + Led3 = Led4 = 0; + TempMax(); + wait(2); + } + } + return 0; +} +void TempMax() +{ + if(sensor > 29.0 + ) { + Led1 = Led2 = 1; + fs.printf("Temp. %0.3f", (float)sensor); + } else { + Led1 = Led2 = 0; + fs.printf("Temp. %0.3f", (float)sensor); + } - } else { - fs.printf("Device not found!\r\n"); - } - /*fs.printf("LED schalten mittels UART\r\n"); - fs.printf("FSST 3BHEL\n"); - fs.printf("Druecken Sie eine Taste 1, 2, 3 oder 4 (LED)\r\n"); +} + + + + + + + +/*fs.printf("LED schalten mittels UART\r\n"); +fs.printf("FSST 3BHEL\n"); +fs.printf("Druecken Sie eine Taste 1, 2, 3 oder 4 (LED)\r\n"); +while(1) { + ch=fs.getc(); + switch (ch) { + case '1': + Led1=!Led1; + break; + case '2': + Led2=!Led2; + break; + case '3': + Led3=!Led3; + break; + case '4': + Led4=!Led4; + break; + default: + fs.printf("Druecken Sie eine Taste 1, 2, 3 oder 4 (LED)\r\n"); + break; + + + + if (sensor.open()) { + fs.printf("Device detected!\r\n"); while(1) { - ch=fs.getc(); - switch (ch) { - case '1': - Led1=!Led1; - break; - case '2': - Led2=!Led2; - break; - case '3': - Led3=!Led3; - break; - case '4': - Led4=!Led4; - break; - default: - fs.printf("Druecken Sie eine Taste 1, 2, 3 oder 4 (LED)\r\n"); - break; - } - }*/ -} \ No newline at end of file + Led4=1; + wait(0.5); + Led4=0; + wait(0.5); + fs.printf("Temperatur =%.3f\n\r",(float)sensor); + wait(0.5); +} +} else { + fs.printf("Device not found!\r\n"); + } + }*/