Fikret Eren
/
M0BOARD_FSST03
x
Fork of M0BOARD_FSST03 by
main.cpp
- Committer:
- FikretEren
- Date:
- 2016-10-05
- Revision:
- 2:e73e456e0542
- Parent:
- 1:60247c53e9f8
File content as of revision 2:e73e456e0542:
#include "mbed.h" #include "LM75B.h" DigitalOut Led1(LED1); DigitalOut Led2(LED2); DigitalOut Led3(LED3); DigitalOut Led4(LED4); Serial fs(USBTX, USBRX); LM75B sensor(p28, p27) ; AnalogIn LDR(p16); AnalogIn poti(p15); void TempMax(); int main() { char ch; if(sensor.open() != 0) { fs.printf("Geraet gefunden"); while(1) { 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); } } /*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) { 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"); } }*/