I almost forgot this...this is another try i did but it also doesnt work...
#include <LiquidCrystal.h>
// Initializing the lcd in the inserted pins
//
const int rs = 12, en = 11, d4 = 7, d5 = 6, d6 = 5, d7 = 4;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
volatile float coins = 0;
void setup() {
lcd.begin(16, 2); //Initialize of lcd and connect the pin "coin"
pinMode(2, INPUT_PULLUP); // to pin 2
attachInterrupt(0, coinInserted, FALLING); //Interrupt for the coins
lcd.setCursor(5,0);
lcd.print("Credits");
}
void coinInserted() //This is the interrupt i want to make
{
delay(2000);
coins=coins + 0.1;
}
void loop() { //...and displaying the coin on the lcd
lcd.setCursor(1,0);
lcd.print(coins);
}
With this code, the only thing i managed to display everything as float...it works when i insert 10 cent and 20 cents....thinking of changing the programming of the coin acceptor...