Hello, just to let you know that i have running an app in the cloud (webfaction) that uses the imp and an rfid reader to control outside workers in my company
It uses websockets to update the webpage in real time
So far its doing fine.
See attached photos of my baby
no.
Just to log user in/out the company and in case of security procedures , to know where people are.
We will have beside entrante points, meeting points(in case of evacuation) with imp+rfid readers.
its has uart or i2C but i didnt find docs about i2c so i used uart
i can be programmable.
I use it in 2 diferent way
1 when card detected, send tag via uart. This is what i use in this project.
2 when card detected , change mode to detect card leave, so this can be used like a hotel room , when card over reading area power on electricity, as soon as card leaves the area, power off electricity.
I have this configuration to control access to a printer by authorized workers
my code for the option 2.
( the option 1 is obvious reading this code)
first i write \x02 to detect id card
when i have the card id i write \x01 to detect card leave
When card leave i set again to first state \x02
`
local tag=[1,2,3,4];
local indextag=0;
local id="";
function cardleave()
{
local b = rfid.read();
// server.log(b);
while (b != -1) {
server.log(b+1);
if (b==254){ //254 is the read value when card leaves the detecting range
server.log(“card removed”);
agent.send(“OUT”,“emb”);
rfid.configure(9600, 8, PARITY_NONE, 1, NO_CTSRTS, detectcard);
rfid.write("\x02");
}
else{
server.log(“keep reading”);
}
b = rfid.read();
}
}
function detectcard()
{
local b = rfid.read();
// server.log(b);
while (b != -1) {
//ledon() ;
if (indextag==3){
tag[indextag]=b;
indextag=0;
server.log(tag[0]+" “+tag[1]+” “+tag[2]+” “+tag[3]);
agent.send(“IN”,tag[0]+” “+tag[1]+” “+tag[2]+” “+tag[3]);
rfid.configure(9600, 8, PARITY_NONE, 1, NO_CTSRTS, cardleave);
rfid.write(”\x01");
}
else{
tag[indextag]=b;
indextag+=1;
}
b = rfid.read();
}
}
rfid <- hardware.uart12;
rfid.configure(9600, 8, PARITY_NONE, 1, NO_CTSRTS, detectcard);
rfid.write("\x02");