I've added the readme file to examples containing serial communication codes.
And I finished the serial command example about KBD101. I tested the example with the KBD101. The program runs fine in most cases. The biggest bug I met was that sometimes the serial communication failed and the KCube got totally stuck. The device even can't respond to the wheel or the button, and I can't turn off the device. Such phenomenon doesn't happen every time running the code, but there's some regularity, like getting stuck every third time running the code after rebooting the KCube.
I suspected the problem is caused by the transmit buffer or the time interval between two write commands. So I tried to optimize the code. It didn't work at first. I tried many times and I'm not confident the problem is 100% solved now, but I ran the latest code more than 10 times, the KCube doesn't get stuck.
I've added the readme file to examples containing serial communication codes.
And I finished the serial command example about KBD101. I tested the example with the KBD101. The program runs fine in most cases. The biggest bug I met was that sometimes the serial communication failed and the KCube got totally stuck. The device even can't respond to the wheel or the button, and I can't turn off the device. Such phenomenon doesn't happen every time running the code, but there's some regularity, like getting stuck every third time running the code after rebooting the KCube. I suspected the problem is caused by the transmit buffer or the time interval between two write commands. So I tried to optimize the code. It didn't work at first. I tried many times and I'm not confident the problem is 100% solved now, but I ran the latest code more than 10 times, the KCube doesn't get stuck.