nyc.rb talk about the Arduino and RAD (and Ruby/Serialport)

4 views
Skip to first unread message

David Michael

unread,
Apr 8, 2008, 10:47:15 AM4/8/08
to Ruby Arduino Development
I will be giving a short presentation involving RAD at the nyc.rb
meeting here in New York City tonight at 7ish for those in the area.
The meeting with be held at the Bway.net offices.

The talk will introduce the Arduino for those Rubyists not yet
drinking the microcontroller Kool-Aid and how to use RAD and Ruby/
Serialport to program and talk to it. Short and sweet.

If there are any topics involving RAD and its future that you guys
would like me make mentions of (or if you would like a preview of the
keynote doc), please let me know.

http://nycruby.org/wiki/pages/April+8+2008+Meeting+Agenda
http://nycruby.org


David
http://unnature.net

Greg Borenstein

unread,
Apr 8, 2008, 12:47:59 PM4/8/08
to ruby-arduino...@googlegroups.com
David,

Cool! Can't wait to see the slides. Will there be video at any point?

Let me know how it goes...

yours,

Greg

David Michael

unread,
Apr 8, 2008, 2:49:49 PM4/8/08
to ruby-arduino...@googlegroups.com

Cannot guarantee any video, but there will definitely be slides :)

D

David Michael

unread,
Apr 8, 2008, 11:15:49 PM4/8/08
to Ruby Arduino Development
Just a quick follow-up.
The talk went quite well and people seemed pretty enthused about RAD
and the Arduino in general.

Here are the slides:
http://blog.unnature.net/post/31202116

David

Greg Borenstein

unread,
Apr 9, 2008, 1:25:08 PM4/9/08
to ruby-arduino...@googlegroups.com
Nice!

Super clear walkthrough of the whole RAD process.

Plus, I really like that use of observer to communicate with the
serial port. I've wanted something like Processing's SerialEvent
callback for various ruby scripts I've written (was actually working
on a module to add serial interaction to Shoes, _why the lucky stiff's
mini GUI toolkit) and the observer module seems like a great way to
achieve that.

Excited to see how your work on the serial console comes along!

-- Greg

David Michael

unread,
Apr 9, 2008, 3:28:34 PM4/9/08
to ruby-arduino...@googlegroups.com
Nice nice

Yeah, the observer module is a dead simple method of event
notification. I do not know how efficient it is, but it should be
fine. A slightly modified version of the code in the slide works well
as a basic event monitor, Rails console style, and I used it with my
talk (Ill post that a little later). If we could settle on a logical
naming for the classes and the console and its location, I can package
up a preliminary version just to have something for people to work
with. Perhaps start another topic for that. I also wonder if Guillaume
Pierronnet would be interested in letting us convert Ruby/Serial into
a gem so RAD can be dependent on it (thus facilitating an autoinstall).

The main challenge in using that class it that it blocks all other
processes while reading the port, which doesn't really matter for a
console app. For other applications, I am not sure if it should be
used as a service of some sort, a daemon, or if its use requires
multithreading... suggestions?

David

adamwest

unread,
Apr 10, 2008, 11:27:17 AM4/10/08
to Ruby Arduino Development
As for multi-threading, you could very easily open a new dedicated
thread for the server. I think the syntax is something like
Thread.new{ puts 'hello world' }.
Josh

David Michael

unread,
Apr 10, 2008, 11:43:10 AM4/10/08
to Ruby Arduino Development

Agreed, threading is an easy way to do it in program.

client = SerialClient.new # any class with an update method
server = SerialReader.new
server.add_observer client

thread = Thread.new do
server.run
end
thread.join

I could just encapsulate this into the library so the details are
hidden.
I suppose I was curious if it was worth setting this up as a daemon of
some sort that you start like a webserver so a number of separate Ruby
programs can access the same incoming data (especially since serial
ports dont like to share the connection). Overkill?

D
Reply all
Reply to author
Forward
0 new messages