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.
Dependencies: CPU_Usage NetworkManager RestAPI_Manager
module_for_all.cpp
00001 #include "module_for_all.h" 00002 00003 DigitalOut led1(LED1); 00004 DigitalOut led2(LED2); 00005 DigitalOut led3(LED3); 00006 00007 void split(const std::string& tmpString, 00008 std::vector<std::string>& stringVector, 00009 const char* delim = " ") { 00010 stringVector.clear(); 00011 char* buffer = new char[tmpString.size() + 1]; 00012 std::copy(tmpString.begin(), tmpString.end(), buffer); 00013 char* p = std::strtok(buffer, delim); 00014 do { 00015 stringVector.push_back(p); 00016 } while ((p = std::strtok(NULL, delim))); 00017 } 00018 00019 char* stringToChar(std::string tmpString) { 00020 char* tmpChar = new char [tmpString.length()+1]; 00021 std::strcpy(tmpChar, tmpString.c_str()); 00022 return tmpChar; 00023 } 00024 00025 void LED_PowerStart() { 00026 led1 = 1; 00027 led2 = 0; 00028 led3 = 0; 00029 wait(0.1); 00030 } 00031 00032 void LED_NetWait() { 00033 led1 = 0; 00034 led2 = 1; 00035 led3 = 0; 00036 wait(0.1); 00037 } 00038 00039 void LED_NetProcess() { 00040 led1 = 0; 00041 led2 = 0; 00042 led3 = 1; 00043 wait(0.1); 00044 } 00045 00046 int countRoot(std::string& tmpString) { 00047 int count = 0; 00048 char* tmpAPI = stringToChar(tmpString); 00049 for (int ii=0;ii<strlen(tmpAPI);ii++) { 00050 if(tmpAPI[ii]=='/') { 00051 count++; 00052 } 00053 } 00054 return count; 00055 }
Generated on Sun Jul 17 2022 12:37:49 by
1.7.2