Hallo evreyone,
I am a beginner doing projects with TTN
Currently I am working with Microchip SAMR34.I was trying to do a project where it reads the entered number and dsiplays it, The enetred number can be seen using an Emulator. I have used TeraTerm for this purpose.
The serial Data handler given in the example Project reads only one character, I have modified the code in such a way it reads more than one character at a time.The value received is stored int to a buffer SerialBuffer, But once number is entered for join request, its stops the application process and doesnot moves further.
The code given below is form the example project:
static char SerialBuffer;
void serial_data_handler(void)
{
int rxChar;
char serialData;
if (startReceiving == true)
{
if((-1) != (rxChar = sio2host_getchar_nowait()))
{
serialData = (char)rxChar;
if((serialData != ‘\r’) && (serialData != ‘\n’) && (serialData != ‘\b’))
{
startReceiving = false;
serialBuffer = rxChar;
appPostTask(PROCESS_TASK_HANDLER);
printf("\r\n");
}
}
}
}
What I have tried:
what i have tried: But it is not working !
void serial_data_handler(void)
{
char serialData;
char arr[10];
char recv;
int i = 0;
int value;
recv = 0x00;
if (startReceiving == true)
{
while(('\n' != recv)&&('\r' != recv) && ('\b' != recv))
{
recv = sio2host_getchar();
arr[i] = recv;
i++;
}
value =(int)atoi(arr);
serialBuffer = value;
appPostTask(PROCESS_TASK);
}
}
if anyone has any idea, please share . It would be a great help!
Thanks