Closed jcasimir closed 9 years ago
Try replacing your sleep
call with a while
or loop
loop, you can make it sleep for a little bit in the loop and see if that helps.
The other is catch a sigterm and close all threads with Thread#join. I thought this would be an issue but it never came up for me before now.
This was caused by serialport
not being able to read whole lines on Windows using gets
.
As of https://github.com/austinbv/dino/commit/7fcf387132dbda80f7ae34d203e71cb113da7e9e, we are using the rubyserial
gem, I have made the handshake routine better, and there are a couple other fixes for enumerating the callbacks hash that raised exceptions in Windows.
I have tested that commit extensively on Windows XP and 7 for both input and output and it's more reliable than anything previously done with the serialport
gem. However, you must still explicitly specify the COM port. Enumeration doesn't work like in *nix yet.
Thanks! :100: :+1:
I'm trying to run this code:
http://tutorials.jumpstartlab.com/codenow/nightlight.rb
Based on the second project I wrote up in this tutorial:
http://tutorials.jumpstartlab.com/codenow/introducing_arduino.html
The first project is working fine. This one appears unable to read from the analog pin. Ideas I've tried:
I'm not getting anywhere. The on_read callback is never getting triggered. I presume the board is not able to read the pin.
One thing that stood out -- on OS X I have no problem using ctrl-c to break execution while the code runs. On windows, though, it just "hangs." No keyboard input can break the running program. This has me thinking that there's some difference in either how
sleep
is handled or how theThread
is spun off for the device.I'm brain dead right now. I hope to look at this again in the morning. I know others probably don't have access to Windows -- but I'd love some ideas of places to investigate.