   }
   else if (r) {
     pinMode(PIN_LEDS, OUTPUT);
-    digitalWrite(PIN_LEDS, 1);
+    digitalWrite(PIN_LEDS, 0);
   } else {
     pinMode(PIN_LEDS, OUTPUT);
-    digitalWrite(PIN_LEDS, 0);
+    digitalWrite(PIN_LEDS, 1);
   };
 }
 

      break;
    case VACUUM:
      if (millis() - laststatechange > VACUUM_TO) {
        send("vacuumoff");
        machinestate = ENERGIZED;
      };
      vacuum = 1;
      break;
    case RUNNING:
      red = LED_ON; green = LED_OFF;
      relayenergized = 1; vacuum = 1;
      break;
  };
  digitalWrite(PIN_POWER, relayenergized);
  digitalWrite(PIN_VACUUM, vacuum);

  if (laststate != machinestate) {
    laststate = machinestate;
    laststatechange = millis();
  }
}

void checkTagReader() {
  MFRC522::Uid uid = { 0, 0, 0 };
  static unsigned long test = 0;
  if (millis() - test > 15000) {
    uid = { 4, { 1, 2, 3, 4}, 0 };
    test = millis();
  }
#if 0
  // Look for new cards
  if ( ! mfrc522.PICC_IsNewCardPresent()) {
    return;
  }

  // Select one of the cards
  if ( ! mfrc522.PICC_ReadCardSerial()) {
    return;
  }
  uid = mfrc522.uid;
  // Dump debug info about the card; PICC_HaltA() is automatically called
  // mfrc522.PICC_DumpToSerial(&(mfrc522.uid));
#endif

  if (uid.size) {

    lasttag[0] = 0;
    for (int i = 0; i < uid.size; i++) {
      char buff[5];
      snprintf(buff, sizeof(buff), " % s % d", i ? " - " : "", uid.uidByte[i]);
      strcat(lasttag, buff);
    }
    lasttagbeat = beatCounter;

  }
#endif

  if (machinestate == WAITINGFORCARD && millis()-laststatechange > 500)
    if (checkTagReader())
      machinestate = CHECKING;
}

