Coin acceptor with arduino

Hello guys im new to all these and i might need a more experienced opinion .
What i have is this coin acceptor

https://www.ebay.com/itm/Multi-Coin-Acceptor-Selector-Mechanism-Vending-Arcade-Machine-/202761180396?_trksid=p2349624.m46890.l49292

What i want to do is by inserting three coins in it, an elentromagnet is turned off and a drawer is released.

I have written the code which is this one :
#include <JC_Button.h>
// pin assignments
const byte BUTTON_PIN(2);
const byte LED_PIN(13);
int coincount = 0;
Button myBtn(BUTTON_PIN);
void setup() {
myBtn.begin();
pinMode(LED_PIN, OUTPUT);
}
void loop() {
myBtn.read();
if (myBtn.wasReleased()) {
coincount++;
}
if (coincount > 2) {
digitalWrite(LED_PIN, HIGH);
}
else {
digitalWrite(LED_PIN, LOW);
}
}

And the diagramm is in the following pic.
Any idea on what i have made wrong and it cannot work will be usefull!
Thanx in advance!!

Pic.jpg

Pic.jpg

Interesting idea, however I would suggest you do a bit of simple research where you will find it is not really feasible as defined for a long term project. Not even sure it will work on the bench. Given that a typical Alkaline 9V block has a capacity of approx 450mAh, this means it drains the battery in just over 12 hours or less 1 day. (450mAh35/mA). The 35mA is a SWAG, I have not found a consistent answer. The main thing is what is enabled on the board such as the FTDI, LED, etc, they require power. This does not account for any additional load. The speci on your coin changer is 12V plus or minus 20%. That indicates as soon as any load is applied to the battery it will go below that value in a very short time. Use a better power source and it may work. I am not sure if it is useful, that you need to decide. Sorry I did not spend the time on the software.