Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of _Lektion_02e by
Revision 1:60247c53e9f8, committed 2016-09-28
- Comitter:
- FlorianStark
- Date:
- Wed Sep 28 08:54:03 2016 +0000
- Parent:
- 0:f61110000c3b
- Commit message:
- M0Board;
Changed in this revision
LM75B.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LM75B.lib Wed Sep 28 08:54:03 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/neilt6/code/LM75B/#7ac462ba84ac
--- a/main.cpp Fri Mar 06 07:59:42 2015 +0000 +++ b/main.cpp Wed Sep 28 08:54:03 2016 +0000 @@ -1,34 +1,48 @@ -#include "mbed.h" -// HIMBED Lektion_02e "Lauflicht über 12 LED mit 2 LED via BUS" -// BULME Graz, 2014-02-09, by Enekel -// AUFGABE: 1) Kopiere diese Software in ein neues Programm -// und gib diesem Programm deinen Namen ! -// 2) Verändere sie so, dass ein Lauflicht über 12 LED ensteht. -// Je 2 LED sollen hin und her laufen über alle 12 LED -// Am Anfang und am Ende darf kein LED leuchten ! -// Verwende dazu einen BUS. -// DEFINITIONEN ************************************************* -BusOut led(P1_13,P1_12,P1_7,P1_6,P1_4,P1_3,P1_1,P1_0,LED4,LED3,LED2,LED1); -// LSB MSB +#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) ; +char ch; -// HAUPTPROGRAMM *********************************************** int main() { - myled=0xFFFF; // Alle 12 LED EIN - wait(1); // warte 1 sec. - while(1) - { - led=0x0000; //LED 0000 0000 00000 - wait 0.2; - // 0000 0000 00001 - // 0000 0000 00011 - // 0000 0000 00110 - // 0000 0000 01100 - // 0000 0000 11000 - // 0000 0001 10000 - // usw - // wieder zurück ! ! - - } -} -// ENDE ***************************************************** - + 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"); + } + /*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; + } + }*/ +} \ No newline at end of file