Perhaps getting a bit off topic for MacRuby list now... Back when I was doing this Arduino didn't exist, I was programming Microchip PIC 16F877 chips in C, I seem to remember that when you receive an interrupt it disables more interrupts from the same source until you reset the bit in the relevant register. You can just debounce the input in software by sampling the state of the input pin a couple of times with a few ms between them then re-enable the interrupt for that port. There must be a similar mechanism for dealing with this problem on with Arduino/Atmel chips? But yeah, you can find yourself spending days trying to work out why your code stopped working, sometimes with only an LED for feedback! It's good fun working on things that do something immediate and physical though, good luck with your project,

On 20 Jan 2012, at 20:51, macruby-devel-request@lists.macosforge.org wrote:

Message: 3
Date: Fri, 20 Jan 2012 12:43:46 -0800
From: Rich Morin <rdm@cfcl.com>
To: "MacRuby development discussions."
<macruby-devel@lists.macosforge.org>
Subject: [MacRuby-devel] CNC Machine control using USB to IEEE 1284
Parallel port adapter
Message-ID: <p06230933cb3f80f6c1e1@[192.168.1.205]>
Content-Type: text/plain; charset="us-ascii"

Using a general-purpose OS (eg, Mac OS X) for real-time
applications is a bit of a tarpit.  So, I like the idea
of using an Arduino (etc) for this sort of thing.

That said, there are some things that will cause problems
even in an Arduino.  For example, taking raw input from a
switch or button may cause the Arduino to see a bunch of
momentary spikes as the mechanical contacts settle.

So, consider using some sort of hardware input filtering
(eg, a one-shot or some analog filtering).  This will be
far easier than trying to make your code handle the extra
interrupts.

-r
-- 
http://www.cfcl.com/rdm            Rich Morin
http://www.cfcl.com/rdm/resume     rdm@cfcl.com
http://www.cfcl.com/rdm/weblog     +1 650-873-7841

Software system design, development, and documentation


------------------------------