I am planning to use Arduino Uno to control one LED based on the binary sequence (100011100…) stored in one text file. I have written one Processing code to read and pass the data to the arduino board via serial communication port.
For a short binary sequence length, e.g. 10 or 20 , I can get exactly the output signal from the arduino board’s digital pin. However, once the length increases to more than 64, it seems only the first 64 bit data can be passed via the serial port.
I am aware that the input serial port buffer is 64 byte, so I use a if-else statement in the Processing code to pass only 64 binary data to the serial port, then clear the buffer, then pass another 64 binary data. However, it will not change the output to the one I expect.
One strange thing is that, if I change the baud rate to a low value (e.g. 600) from the standard one (9,600 ), I can get the output signal that is even longer than expected from the arduino board. In practice, I need to send a binary sequence with a length of ~1 million. Is there any efficient way of solving this problem? Or do you have any other recommendations on hardware part which can handle such large data?
I have attached both the Processing and Arduino code, any suggestion will be appreciated. Many thanks in advance.
read_data_100bit.pde (2.04 KB)
test.ino (936 Bytes)
100bit.txt (199 Bytes)