// strtok_r_comma_split
// String strKey1 = (char*)keyData; // 字元陣列 to 串流 keyData to String
// strKey1.toCharArray((char*)keyData, strKey1.length() + 1); // 串流 to 字元陣列 string to keyData.
/*
http://forum.arduino.cc/index.php?topic=186687.0
*/
// strtok_r_comma_split_testOK
//------------------ EEPROM 結構 -------------------------------------------------------------
struct espConf {
char wifiSsid[20];
char wifiPass[20];
char iotKey[16];
char set_1[4];
char set_2[4];
};
espConf config_1 = { "1100", "74sjfekjtrhe", "------!","63", "31" };
String adminConfString = "2100,wsderf4321543d,IoT_Write_KEY_16,70,4";
void setup () {
Serial.begin (115200);
delay(200);
Serial.println("---------read struct ------------");
Serial.println((char*)config_1.wifiSsid);
Serial.println((char*)config_1.wifiPass);
Serial.println((char*)config_1.iotKey);
Serial.println((char*)config_1.set_1);
Serial.println((char*)config_1.set_2);
Serial.println();
delay(200);
int strLng = adminConfString.length() + 1;
char sz[strLng];
adminConfString.toCharArray(sz, strLng); // Convert string to array. 串流 轉 字元陣列sz
char *str;
// char sz[] = "2100,poiuytrewqpoi,IoT_Write_KEY_16,70,4"; // char array
char *p = sz; // char array
static int i = 0;
String g0, g1, g2;
String g3, g4;
while (( str = strtok_r(p, ",", &p)) != NULL) { // NULL就可以了,代表我没有数据给你,你就用剩下的数据就可以了。
if (i == 0) g0 = str;
if (i == 1) g1 = str;
if (i == 2) g2 = str;
if (i == 3) g3 = str;
if (i == 4) g4 = str;
i++;
Serial.println(str); // String
}
int c_g3 = g3.toInt(); // String to int
int c_g4 = g4.toInt(); // String to int
Serial.print(g0); Serial.print(","); // ptint String g0
Serial.print(g1); Serial.print(","); // ptint String g1
Serial.print(g2); Serial.print(","); // ptint String g2
Serial.print(c_g3, DEC); Serial.print(","); // ptint int c_g3
Serial.print(c_g4, DEC); Serial.println(" "); // ptint int c_g4
g0.toCharArray(config_1.wifiSsid, g0.length() + 1); // Convert string to array. 串流 轉 字元陣列
g1.toCharArray(config_1.wifiPass, g1.length() + 1); // Convert string to array. 串流 轉 字元陣列
g2.toCharArray(config_1.iotKey, g2.length() + 1); // Convert string to array. 串流 轉 字元陣列
g3.toCharArray(config_1.set_1, g3.length() + 1); // Convert string to array. 串流 轉 字元陣列
g4.toCharArray(config_1.set_2, g4.length() + 1); // Convert string to array. 串流 轉 字元陣列
// config_1.set_1 = c_g3;
// config_1.set_2 = c_g4;
Serial.println("---------write struct ------------");
Serial.println((char*)config_1.wifiSsid);
Serial.println((char*)config_1.wifiPass);
Serial.println((char*)config_1.iotKey);
Serial.println((char*)config_1.set_1);
Serial.println((char*)config_1.set_2);
Serial.println();
delay(200);
}
// String strKey1 = (char*)keyData; // 字元陣列 to 串流 keyData to String
// strKey1.toCharArray((char*)keyData, strKey1.length() + 1); // 串流 to 字元陣列 string to keyData.
void loop () { }
// String_comma_split
https://stackoverflow.com/questions/11068450/arduino-c-language-parsing-string-with-delimiter-input-through-serial-interfa
String myString = ",daqwete0,rec23123ipt,weiqweght,timadsdasde,dasdasdasdasdte,";
// the setup routine runs once when you press reset:
void setup() {
Serial.begin(115200);
int Index1 = myString.indexOf(',');
int Index2 = myString.indexOf(',', Index1 + 1);
int Index3 = myString.indexOf(',', Index2 + 1);
int Index4 = myString.indexOf(',', Index3 + 1);
int Index5 = myString.indexOf(',', Index4 + 1);
int Index6 = myString.indexOf(',', Index5 + 1);
String Value_1 = myString.substring(Index1 + 1, Index2);
String Value_2 = myString.substring(Index2 + 1, Index3);
String Value_3 = myString.substring(Index3 + 1, Index4);
String Value_4 = myString.substring(Index4 + 1, Index5);
String Value_5 = myString.substring(Index5 + 1, Index6);
//Serial.println(Index1);
Serial.println(Value_1);
Serial.println(Value_2);
Serial.println(Value_3);
Serial.println(Value_4);
Serial.println(Value_5);
}
// the loop routine runs over and over again forever:
void loop() {
}
Borgata Bonus Code 2021 - $200 Deposit Match + 100 Free Spins
回覆刪除A 프라그마틱 슬롯 no deposit bonus, a no deposit 승부예측사이트 bonus, and a 포커 고수 free bet bonus is the type of free bet you must make at 가입시 꽁 머니 환전 the 네이버 룰렛 돌리기 casino. Once you have signed up, you will be