problem with atoi function

Hi there:

I am reading from a bluetooth connection some numbers, in this way:


this is the code:

char input; // variable to receive data from bluetooth char inputstring; //the string with the numbers int dato; //the number in inputstring

... ...

void loop() {

if( bluetooth.available() ) // if data is available to read { input =; // read it and store it in 'input' if (input != '#') {inputstring += input;} else //all the number is readed {dato = atoi(inputstring); inputstring = ''; //the string is deleted bluetooth.println(dato); }

} }

the compiler says that dato = atoi(inputstring) is not correct. "Invalid conversion from 'char' to 'cont char*'. I have changed the definition of input and stringinput with no success, for example char inputstring[4]

Any help? Thanks in advance

atoi expects a null-terminated C string - passing it a single character will never work, as you've found. A single character is also useless for multi-digit numbers, so the array is the only way to go.

Please use code tags when posting code.

now works... thanks!