This is a simple Arduino sketch for Leonardo boards that
a) continuously reads input from an analog pin (here connected to a TinkerKit LDR)
b) sends a space bar press over the HID when the reading is above a threshold
This can be adapted to build a simple response box based on the Arduino Leonardo. If you connect a button instead of an LDR, change the input from analog to digital