I need help with a very interesting topic for school, Please can you help me

This is an update for my previous project. I am making a credit system. Exactly like the ones in arcade games where you load up your card an play games till the balance runs out. This is a skeleton for any project I need to make in the future.
I want to load up some points in a rfid card- DONE
then I want to display the amount in the card - DONE
when I press a certain button, I want the balance in the card to increase by $100 and that value should be displayed on the LCD Display - NOT DONE
I also want to make a system where if the card is placed and another button is pressed, the value in the card should decrease by $50 and it should show on the LCD that the product is
dispensed - NOT DONE

I am a new Arduino developer and I would really like some help with the above tasks. If someone could please help me and write some code for it or at least help me, I would be very grateful to them and hold them with very high regard in my future programming life.

Here is some of my code that I wrote myself with some help from the forum a little earlier.

#include <LiquidCrystal_I2C.h>
#include <SPI.h>
#include <MFRC522.h>

#define RST_PIN         9           // Configurable, see typical pin layout above
#define SS_PIN          10          // Configurable, see typical pin layout above

LiquidCrystal_I2C lcd(0x27,20,4);

MFRC522 mfrc522(SS_PIN, RST_PIN);   // Create MFRC522 instance

void setup() {
  Serial.begin(9600);                                           // Initialize serial communications with the PC
  SPI.begin();                                                  // Init SPI bus
  mfrc522.PCD_Init();  
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0,0);
}

//*****************************************************************************************//
void loop() {

  // Prepare key - all keys are set to FFFFFFFFFFFFh at chip delivery from the factory.
  MFRC522::MIFARE_Key key;
  for (byte i = 0; i < 6; i++) key.keyByte[i] = 0xFF;

  //some variables we need
  byte block;
  byte len;
  MFRC522::StatusCode status;

  //-------------------------------------------

  // Reset the loop if no new card present on the sensor/reader. This saves the entire process when idle.
  if ( ! mfrc522.PICC_IsNewCardPresent()) {
    return;
  }

  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) {
    return;
  }



  //-------------------------------------------



  //mfrc522.PICC_DumpToSerial(&(mfrc522.uid));      //uncomment this to see all blocks in hex

  //-------------------------------------------

  lcd.print(F("Credits: "));

  byte buffer1[18];

  block = 2;
  len = 18;

  //------------------------------------------- GET FIRST NAME
  status = mfrc522.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, 2, &key, &(mfrc522.uid)); //line 834 of MFRC522.cpp file
  if (status != MFRC522::STATUS_OK) {
    Serial.println(mfrc522.GetStatusCodeName(status));
    return;
  }

  status = mfrc522.MIFARE_Read(block, buffer1, &len);
  if (status != MFRC522::STATUS_OK) {
    Serial.println(mfrc522.GetStatusCodeName(status));
    return;
  }

  //PRINT FIRST NAME
  for (uint8_t i = 0; i < 16; i++)
  {
    if (buffer1[i] > 32)
    {
      Serial.write(buffer1[i]);
      
      lcd.print((char)buffer1[i]);
    }
  }

  delay(3000); //change value if you want to read cards faster
  
lcd.clear();

  mfrc522.PICC_HaltA();
  mfrc522.PCD_StopCrypto1();
}

You are planning to start a business and you want kind people to work on this project for free.

Hey, sorry I hope i am not pushing anyone, I am not actually planning to start a business, this is a school project I need some help with. Please, just guide me, if its to much to write the code then don't. but please just give me some directions, functions.

No problem ... kolaha was just joking, I suspect.

You need a "state machine" design. You already have done the hard work reading the card and displaying the info.

#define a button for increment, pin#
#define a button for decrement, pin#
// both of above before setup()

// in setup()
 - make BOTH button pin# a INPUT_PULLUP

// in loop()
-  bool flag = false;

-  if( button_Increment_pin# == false) {  // Increment button pushed
     your code to increment;
     flag = true;
  }

-  if( button_Decrement_pin# == 0) { //Decrement button pushed
     your code to decrement;
     flag = true;
  }

-  if (flag) {
    your code to write new value to card;
  }

} // end of loop() closure

Enhancements:
STUDY how to de-bounce buttons

I am not sure how to write new values to cards and store the pre existing value in a variable and then add $50 to that variable, example, x = x+50. I really need help with that

Time to study example code:

More specifically:

Thanks

Hey, this is actually really overwhelming, Its a lot to take in and I am not sure what to do actually.

I want exactly what this guy has

Which is the very reason you must do some reading on MFC522 projects.

Do you know about Google/Bing site search? Look at the criterion syntax I used in the below link.

https://www.bing.com/search?q=MFRC522%20site%3Aarduino.cc

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.