9 years, 6 months ago.

I have a Serial problem!!! PLEASE!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I practice using a Sensor(IMU).

I want to receive a packet from IMU to Embed(411)

I think, this job is very easy! but..

A Imu Packet is

  • Roll,Pitch,Yaw,AccX,AccY,AccZ\n packet's end of line is maybe CL of LF(0x0A, 0x0D)

when I print this packet use by gets, a result is -1.84,-108.93,-0.022,-0.076,0.987 7,0.987

my code is

BT.gets(buffer, sizeof(buffer)); pc.printf("%s"buffer); memset(buffer,0,sizeof(buffer);

but when I was use a getc, the result is good. temp_char = BT.getc(); pc.putc(temp_char);

  • -1.84,-108.96,-0.038,-0.087,0.986,0.993

why? why this hppen? there is a diffrence getc() with gets() functions?

0x0A, 0x0B is automatic added randomly!

How can I resolve this problem?

Be the first to answer this question.