i need to make a program that will deduct 3 each time the button is pressed. I can’t get my program right. how can i fix it. below is my sample code.pls help me because this is for my project there is no error while compling but when i run the program it only deduct a load once
void loop(){
do{
sensorState = digitalRead(2);
}
while(sensorState == 1);
if(sensorState == 0){
uint32_t id;
id = nfc.readPassiveTargetID(PN532_MIFARE_ISO14443A);
if (id != 0){
uint8_t keys[]= {0xFF,0xFF,0xFF,0xFF,0xFF,0xFF};
uint8_t writeBuffer[16];
uint8_t block[16];
nfc.authenticateBlock(1, id ,0x08,KEY_A,keys);
nfc.readMemoryBlock(1,0x08,block);
load = block[0];
writeBuffer[0] = load - 3;
nfc.writeMemoryBlock(1,0x08,writeBuffer);
}
}
}