Skip to content

Instantly share code, notes, and snippets.

@jonathdb
jonathdb / functions.ino
Created May 30, 2017 16:08
functions to the Alt.ino program
int readBlock(int blockNumber, byte arrayAddress[]) {
int largestModulo4Number=blockNumber/4*4;
int trailerBlock=largestModulo4Number+3;//determine trailer block for the sector
/*****************************************authentication of the desired block for access***********************************************************/
byte status = scanner.PCD_Authenticate(MFRC522::PICC_CMD_MF_AUTH_KEY_A, trailerBlock, &key, &(scanner.uid));
if (status != MFRC522::STATUS_OK) {
//Serial.print("PCD_Authenticate() failed (read): ");
//Serial.println(scanner.GetStatusCodeName(status));
skrivFeilmld();
@jonathdb
jonathdb / Alt.ino
Created May 30, 2017 16:07
Programmet som kjorer
#include <Adafruit_NeoPixel.h>
#include <LiquidCrystal.h>
#include <SPI.h>//include the SPI bus library
#include <MFRC522.h>//include the RFID reader library
#define SS_PIN 10 //slave select pin
#define RST_PIN 9 //reset pin
String name; //ID of the RFID-card
int block=2; //this is the block number we will read.