Arduino powered money counter

I also wanted to ask what would happen if the diode would be partly covered?

Using analogue sensors you would see this half region in the way you want, as proportional. Using digital is is always a 0 or 1. The down side is it takes longer to read an analogue sensor. You can do only about 10,000 reads per second with analogue although there are things you can trade to make it faster.

Do some measurements with photo detectors first and get a feel for how to use them.