Introduction: LinkIt ONE Serial Port Fix
This is a very small Instructable in which I will show you how I prevent loss of data from the serial port. This is necessary because in some conditions, you will need something from the serial monitor but as the LinkIt ONE takes time to initialize the serial port, data will be written out by the time you open the serial port and so, it is lost.
This will result in data not showing in the serial monitor and so this can be very cumbersome.
Step 1: Materials Required
- LinkIt ONE which is already set-up to get sketches uploaded
- USB cable to connect LinkIt ONE to PC
Step 2: The Fix
Download the attached code and then examine it. I have used a while loop before doing anything else and after setting up the serial port. Until and unless anything is entered through the serial port, the code will not be executed beyond the while loop.
If you enter anything, it will be saved in the initializeBuffer variable, whose data type is a string, so numbers and letters can be stored in it, and then the code will move on. For example, in the one I attached, you will be greeted by “Hello World”, only once.
If you have used the Arduino UNO before, you will know that this problem is not there with the UNO as it resets whenever you switch on the serial monitor and also takes less time to initialize than the LinkIt ONE.
You can use in your code but with the condition that the while loop is present before the main code runs and just after the serial port initializes.
We have a be nice policy.
Please be positive and constructive.