Last active
June 24, 2016 18:54
-
-
Save mesutevin/3491209b69986e769fbe64a1c14fcaef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sleep, rfid, setup, count, rfidTest, onInit; | |
sleep = require('aea').sleep; | |
rfid = void 8; | |
setup = function(){ | |
var spiSoftware, chipSelect; | |
spiSoftware = new SPI(); | |
spiSoftware.setup({ | |
sck: D14, | |
miso: D13, | |
mosi: D12 | |
}); | |
chipSelect = D15; | |
return rfid = require('MFRC522').connect(spiSoftware, chipSelect); | |
}; | |
count = 0; | |
rfidTest = function(){ | |
console.log("trying to find card: ", count++); | |
try { | |
return rfid.findCards(function(card){ | |
return console.log("Found " + card); | |
}); | |
} catch (e$) {} | |
}; | |
setup(); | |
onInit = function(){ | |
return function lo(op){ | |
rfidTest(); | |
return sleep(300, function(){ | |
return lo(op); | |
}); | |
}(function(){}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment