One of the tasks on my first IOT project anatomy is to send data to the Arduino from Raspberry PI to my Arduino board.
There is one Arduino feature one needs to consider when sending serial data to Arduino over USB port: Every the serial connection is established, the Arduino is reset. This is a feature that simplifies the process of loading software to the board.
If a script establishes a serial connection to the Arduino, it takes one second for the board to boot. If the script sends serial data during that time, that data is lost. Further, if the connection is released and reestablished, the board reboots.
My solution to that issue is to wait for the board to boot and to keep the connection alive during the entire session.
The data must be encoded to binary format |
The sender script specifies interface, baudrate and timeout and the receiving script sends the incoming string to the display for some seconds.
No comments:
Post a Comment