The code will be easy. The biggest problem is the hardware. If the data is coming in serial TTL (0/5V, as you mention) then you need to know the data rate, when to expect each value. Once you have that information, then you can search on serial input basics and read through the thread on how to read in and interpret serial information.
Post back the timing information or the datasheet and you will be able to make some more progress.