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.
wordString.cpp
00001 00002 #include <sstream> 00003 #include "mbed.h" 00004 00005 string StringFIN; 00006 00007 using namespace std; 00008 00009 00010 extern Serial pc; // tx, rx 00011 00012 string IntToString(int number) 00013 { 00014 stringstream ss; 00015 ss << number; 00016 return ss.str(); 00017 } 00018 00019 void array(int power1,int power2,int power3,int power4) 00020 { 00021 int input[4] = {power1,power2,power3,power4}; 00022 int value = 0; 00023 string StringA[4] = {"0","0","0","0"}; 00024 00025 00026 string StringX = "0"; 00027 string StringY = "0"; 00028 string StringZ = "0"; 00029 string String0 = "0"; 00030 00031 StringFIN = "0"; 00032 00033 for(uint8_t i = 0 ; i < 4; i++){ 00034 00035 value = input[i]; 00036 00037 StringX = IntToString(i+1); 00038 00039 if( (value < 0) && (value >= -100) ){ 00040 StringY = "R"; 00041 value = abs(value); 00042 StringZ = IntToString(value); 00043 }else if( (value >= 0) && (value <= 100) ){ 00044 StringY = "F"; 00045 StringZ = IntToString(value); 00046 }else{ 00047 StringA[i] = StringX + "F" + "000"; 00048 00049 } 00050 00051 if(value < 10){ 00052 String0 = "00"; 00053 StringZ = String0 + StringZ; 00054 }else if(value < 100) 00055 { 00056 String0 = "0"; 00057 StringZ = String0 + StringZ; 00058 }else{ 00059 00060 } 00061 00062 StringA[i] = (StringX + StringY + StringZ); 00063 00064 if(i == 0)StringFIN = StringA[i]; 00065 else StringFIN += StringA[i]; 00066 00067 } 00068 00069 StringFIN += "\r\n"; 00070 }
Generated on Thu Jul 14 2022 06:03:18 by
 1.7.2
 1.7.2