A small Arduino sketch that converts the movements of an accelerometer (specifically the RedBot one from SparkFun Electronics) into threshold switches on two output pins.