hello, I have another newbie question, this is my code:
String test1 ="hello world";
String test2 ="this is a test";
char * test;
char * test3;
int i;
int h;
for(i=0;i<test1.length;i++) {
test[i] =test1[i];
}
for(h=0;h< test2;h++) {
test3[h] = test2[h];
}
Serial.println(test);
Serial.println(test3);
I am getting the following output:
hÿellow world
yyyyyyyyyyyyyyyyyyyyyyyyy¸y
why am i getting these outputs?
it may be better to explain what it is you are trying to do and posting your full code...
Does your baud rate in your program match the rate in the Serial monitor?
Delta_G:
then you're program will do what I think you want it to.
... if you also remember to put a terminating NULL character at the end of your character string.
I used this
char anArray[12];
char* test = anArray;
but I am getting the following error:
no matching function call char*[14]
I also get this error at Serial.print:
call of overloaded println char[14] is ambigious
my real problem is:
how can I change the ssid and password of adafruit cc3000?
their code is like this:
#define WLAN_SSID "ssid" // cannot be longer than 32 characters!
#define WLAN_PASS "pass"
cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY, 2)
it seems that WLAN_SSID and WLAN_PASS must be constant chars, so how can I change ssid and pass programmatically?
like I want to change it to wwwssod and wwwpass?
#define WLAN_SSID "ssid" // cannot be longer than 32 characters!
#define WLAN_PASS "pass"
cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY, 2);
If you want to use variables:
char WLAN_SSID[33] = "ssid"; // Default value. Max length 32.
char WLAN_PASS[65] = "pass"; // Default value. Max length 64.
// One way to set the values at run time:
strncpy(WLAN_SSID, "wwwssid", sizeof WLAN_SSID); // Replace with new value
strncpy(WLAN_PASS, "wwwpass", sizeof WLAN_PASS); // Replace with new value
// You could also read new values from Serial or from an SD card or whatever you want.
cc3000.connectToAP(WLAN_SSID, WLAN_PASS, WLAN_SECURITY, 2);