LEGO MINDSTORMS Robot Inventor
This vending machine allows you to choose one of six items to buy with color-coded coins that you insert into a coin slot for scanning by the color sensor.
Select one of the six items to buy using the right arrow button, and the position of the item is highlighted on the grid display and then its price is displayed. Insert coins into the coin slot (teal = 1, white = 5, red = 10, yellow = 25) to pay for the item. Exact change required!
Press the left arrow button to buy the item. If you got the amount right, the item will be pushed out and fall into the front tray. If you got the amount wrong (or if you press the left arrow when no item is selected), then the coin return is triggered and the stored coins are dumped out into the side tray.