Nick_Pyner:
You could constantly poll the input, but only use the data if it not zero. In that event, use it and poll again.
The examples in the IDE show how to set up the SD. You print numbers - myFile.print - just like you print to serial.
thank you!