Tried them on serial monitor and sometimes it gives random output like when I insert P1, it would give 2 P1 and when I insert P5, it would give like 8 of P1. I used the code here, modified to the equivalent of my country's coin value to make my coin slot work but it doesn't seem to recognize other type of coins other than one. The process would be when a certain amount of coins are inserted and pressed the desired size, the 9v water pump will proceed to dispense for a specific amount of time.
My project is a soda vending machine that has 3 buttons for the corresponding cup sizes: small, medium, and large.