system
June 25, 2012, 4:03pm
1
My IDE is not recognising the string.charAt command,
It isnt even highlighting when using example code from the arduino site.
I have seen this issue raised before with no clear answer?
String test;
void setup()
{
Serial.begin(9600);
String test = "23456";
}
void loop()
{
char pointer = test.charAt(2);
Serial.print(pointer);
delay(1000);
}
Any help is great thanks
Arrch
June 25, 2012, 4:06pm
2
ianmgreen:
My IDE is not recognising
Feel free to elaborate and provide more details.
system
June 25, 2012, 4:16pm
3
sorry about that,
The arduino IDE does not highlight the string.charAt() command in orange, and does not act upon it,
im trying to establish whether the code im using is missing something or whether my IDE is setup wrong somehow
Thanks again
Strings are evil.
char test[] = "23456";
void setup()
{
Serial.begin(9600);
}
void loop()
{
int i=0;
while (i < strlen(test) )
{
char pointer = test[i++];
Serial.println(pointer);
delay(1000);
}
}
system
June 25, 2012, 4:36pm
5
thankyou muchly,
Ill have to alter my code a bit to remove the charat command and add in that bit but you have skipped ahead of me there which is lovely, im making a dialer and that bit of code does exactly what i was going to do in a far simpler manner.
Ta very much
Ian
system
June 25, 2012, 11:15pm
6
String test;
A global variable, with no initial value. Useless, but, hey, it's your code.
String test = "23456";
A local variable that immediately goes out of scope. Useless, but, hey, it's your code.
char pointer = test.charAt(2);
The variable named pointer is not a pointer. Lousy choice of names.
What are/were you trying to accomplish?
The variable named pointer is not a pointer. Lousy choice of names.
Agreed, but "hey, it's his code"