Added additional inputs and created a for loop to accumulate more data before writing to the SD card.