Hello,
I'm currently working on a script that reads the content on a serial
port. I need to read using the following logic :
- I start to read
- I read and skip every char until a \u0002 is available
- I read everything and store until a \u0003 is here
I have implemented it in ruby this way : http://pastebin.com/2ihMeXeE
Is the way I'm doing it a good one ? I have this feeling I can do it
in a better way (not with the is_reading bool that sounds clearly a
bad way to do it).
Thank you !
Jérémy
Hi,
You should use rubyserial gem instead of opening special file. See
Regards.
Sylvain
···
Le 14/02/2017 à 10:48, Jérémy Seban a écrit :
Hello,
I'm currently working on a script that reads the content on a serial
port. I need to read using the following logic :
- I start to read
- I read and skip every char until a \u0002 is available
- I read everything and store until a \u0003 is here
I have implemented it in ruby this way : def get_last_trame is_reading = false trame = "" f = File.open(CONFIG[' - Pastebin.com
Is the way I'm doing it a good one ? I have this feeling I can do it
in a better way (not with the is_reading bool that sounds clearly a
bad way to do it).
Thank you !
Jérémy
Unsubscribe: <mailto:ruby-talk-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-talk>