Timing accuracy & Interrupts

infinity and beyond! Down to the nanoseconds :slight_smile:

16! That's how many digital inputs the Spark Core has :smile:

You can implement 12 interrupt routines:
http://docs.spark.io/firmware/#interrupts-attachinterrupt

But you might be able to just poll your sensors very quickly. If you are all set with 12, go for interrupts. You may have some issues though...

Have a look at this interrupt driven pinewood derby code I wrote:

Electrons travel at the speed of light typically (well close to that anyways).. so wirelength only affects resistance of the wire, coupled with any capacitance on your input you can have an RC timeconstant affect... basically the slew rate of the signal transitions can be governed by this capacitance. Fortunately it's really small... all you need to do is pull up your vibration sensor with a lower value resistor, say 1k ohm from the sensor input pin to 3V3. Then tie your vibration sensor from the sensor input to ground. When the sensor wiggles you'll get a bunch of HIGH to LOW transitions.

1 Like