x

Dependencies:   LM75B mbed

Fork of M0BOARD_FSST03 by Florian Stark

Committer:
FlorianStark
Date:
Wed Sep 28 08:54:03 2016 +0000
Revision:
1:60247c53e9f8
Parent:
0:f61110000c3b
Child:
2:e73e456e0542
M0Board;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
FlorianStark 1:60247c53e9f8 1 #include "mbed.h"
FlorianStark 1:60247c53e9f8 2 #include "LM75B.h"
FlorianStark 1:60247c53e9f8 3 DigitalOut Led1(LED1);
FlorianStark 1:60247c53e9f8 4 DigitalOut Led2(LED2);
FlorianStark 1:60247c53e9f8 5 DigitalOut Led3(LED3);
FlorianStark 1:60247c53e9f8 6 DigitalOut Led4(LED4);
FlorianStark 1:60247c53e9f8 7 Serial fs(USBTX, USBRX);
FlorianStark 1:60247c53e9f8 8 LM75B sensor(p28, p27) ;
FlorianStark 1:60247c53e9f8 9 char ch;
Enenkel 0:f61110000c3b 10
Enenkel 0:f61110000c3b 11 int main() {
FlorianStark 1:60247c53e9f8 12 if (sensor.open()) {
FlorianStark 1:60247c53e9f8 13 fs.printf("Device detected!\r\n");
FlorianStark 1:60247c53e9f8 14 while(1) {
FlorianStark 1:60247c53e9f8 15 Led4=1;
FlorianStark 1:60247c53e9f8 16 wait(0.5);
FlorianStark 1:60247c53e9f8 17 Led4=0;
FlorianStark 1:60247c53e9f8 18 wait(0.5);
FlorianStark 1:60247c53e9f8 19 fs.printf("Temperatur =%.3f\n\r",(float)sensor);
FlorianStark 1:60247c53e9f8 20 wait(0.5);
FlorianStark 1:60247c53e9f8 21 }
FlorianStark 1:60247c53e9f8 22 } else {
FlorianStark 1:60247c53e9f8 23 fs.printf("Device not found!\r\n");
FlorianStark 1:60247c53e9f8 24 }
FlorianStark 1:60247c53e9f8 25 /*fs.printf("LED schalten mittels UART\r\n");
FlorianStark 1:60247c53e9f8 26 fs.printf("FSST 3BHEL\n");
FlorianStark 1:60247c53e9f8 27 fs.printf("Druecken Sie eine Taste 1, 2, 3 oder 4 (LED)\r\n");
FlorianStark 1:60247c53e9f8 28 while(1) {
FlorianStark 1:60247c53e9f8 29 ch=fs.getc();
FlorianStark 1:60247c53e9f8 30 switch (ch) {
FlorianStark 1:60247c53e9f8 31 case '1':
FlorianStark 1:60247c53e9f8 32 Led1=!Led1;
FlorianStark 1:60247c53e9f8 33 break;
FlorianStark 1:60247c53e9f8 34 case '2':
FlorianStark 1:60247c53e9f8 35 Led2=!Led2;
FlorianStark 1:60247c53e9f8 36 break;
FlorianStark 1:60247c53e9f8 37 case '3':
FlorianStark 1:60247c53e9f8 38 Led3=!Led3;
FlorianStark 1:60247c53e9f8 39 break;
FlorianStark 1:60247c53e9f8 40 case '4':
FlorianStark 1:60247c53e9f8 41 Led4=!Led4;
FlorianStark 1:60247c53e9f8 42 break;
FlorianStark 1:60247c53e9f8 43 default:
FlorianStark 1:60247c53e9f8 44 fs.printf("Druecken Sie eine Taste 1, 2, 3 oder 4 (LED)\r\n");
FlorianStark 1:60247c53e9f8 45 break;
FlorianStark 1:60247c53e9f8 46 }
FlorianStark 1:60247c53e9f8 47 }*/
FlorianStark 1:60247c53e9f8 48 }