I have this code that read the Raspberry Pi RPIO pin number 24, that is connected to coin acceptor and the datasheet of it is:
0,05€ - 1 pulse
0,10€ - 2 pulse each pulse in 0,025ms
0,20€ - 4 pulse each pulse in 0,025ms
0,50€ - 10 pulse each pulse in 0,025ms
1€ - 20 pulse each pulse in 0,025ms
2€ - 40 pulse each pulse in 0,025ms
And i have this code:
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(24,GPIO.IN)
count = 0
euroCoin = 0
def coin(value):
euro = value * 5
return euro
while True:
inputValue = GPIO.input(24)
if (inputValue == True):
count = count + 1
euroCount = coin(count)
print ("Euro "+str(euroCount)+".")
time.sleep(.025)
That show, for example, for 0,20€ coin show:
0,05
0,10
0,15
0,20
I only need to show the final value, how i do that? Thanks