I am using two xbee’s, one of them is connceted to arduino uno and the second one is connected to the laptop.
what am trying to do is to send an order from the laptop to the arduno to collect data from a microphone and send the data back to the laptop through xbee.
When i collect the data using a matlab code sometimes I receive the complete data and sometimes I lose some of the data.
I need to know if it is a software, hardware or programming problem.
the number of data am trying to send is 100 data points sent one by one through a while loop inside the loop structure.
Thanks in advance for your help.
but this technique needs two arduinos to send between them through the serial port.
in my case I have the xbees, the one connected to the laptop and the second connected to the arduino.
Are these codes useful for my case?
After I looked at the problem I have by making the arduino sending the data am asking for and showing them using the X-CTU software I found that the data sometimes has no meaning.
To be more specific I require the voltage as a function of time from a signal generator and ask the laptop using a matlab code to plot it, so sometimes i don’t receive the 100 points I asked for which has the time and the measured voltage.
The point is that I am not sure if the problem is a programing mistake or the syncronization between the arduino and the matlab, because the matlab start reading the data when the serport.BytesAvailable()~0, otherwise it will not read the data.
Transmitting and sending data serially is a task that everybody needs to do and that can be very time-consuming since it involves reinventing the wheel each time. fortunately, there is now a new library called Easy Transfer by Bill Porter which takes care of this very well and is very easy to use.