Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trying read data from arduino hang the process forever #6

Open
cage2 opened this issue Sep 10, 2018 · 0 comments
Open

trying read data from arduino hang the process forever #6

cage2 opened this issue Sep 10, 2018 · 0 comments

Comments

@cage2
Copy link

cage2 commented Sep 10, 2018

Hello!

Thank you for your library, it is very useful! :)

I am using cserial-port with an arduino mega, i do not know if the problem is arduino-specific or not, though.

Anyway this simple example:

  (cserial-port:with-serial (rs "/dev/ttyACM0" ;; this is the arduino on my system
                                :baud-rate 9600
                                :data-bits 8
                                :stop-bits 1
                                :parity    :none)
    (sleep 1) ;; <- note this call to 'sleep' added
    (cserial-port:write-serial-byte-vector (babel:string-to-octets (format nil "H~%"))
                                           rs)
    (format nil "~a~a"
            (cserial-port:read-serial-byte rs)
            (cserial-port:read-serial-byte rs))))

does not works without calling the sleep; the data is written to the device on the other end of the serial cable (the arduino in my case) but the first read-serial-byte never returns.

With the sleep everything works just fine, the bytes can be fetched and the expression is executed.
Hope this could help to improve this good library.

Thank you for your work! :)
C.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant