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.
main.cpp
- Committer:
- fpucher
- Date:
- 2016-07-01
- Revision:
- 0:d764cafa5989
- Child:
- 1:b9fd13f34c2d
File content as of revision 0:d764cafa5989:
#include "mbed.h" #include <stdio.h> #include <string.h> #include <stdint.h> #include "SerialEvent.h" #include "LM75B.h" #define STR_MAX 40 DigitalOut Led1(LED1); DigitalOut Led2(LED2); DigitalOut Led3(LED3); DigitalOut Led4(LED4); Serial pc(USBTX, USBRX); SerialEvent se(p9, p10); LM75B sensor(p28, p27); char str[STR_MAX]; int index=0; int main(int argc, char* argv[]) { char* pFelder[ANZ_FELDER]; while(1) { Led1 = !Led1;; while(1) { if(se.checkFlag()) { se.getString(str); //printf("String: %s\n", str); break; } } ParseFelder(str, pFelder, ANZ_FELDER, TRENNZEICHEN); for (int i = 0; i < 4; i++) { //printf("\n%s", pFelder[i]); } // set/clear Led4 if(strcmp(pFelder[0], "M0")==0) { if(strcmp(pFelder[1], "SD")==0) { if(strcmp(pFelder[2], "04")==0) { if(strcmp(pFelder[3], "1")==0) Led4 = 1; else Led4 = 0; } } } // send temp from LM75B if(strcmp(pFelder[0], "M0")==0) { if(strcmp(pFelder[1], "GA")==0) { //if(strcmp(pFelder[2], "LM")==0) { char s[20]; sprintf(s, "Temp: %f", (float)sensor); se.pc_send(s); } } } }