تبلیغات
news-iran-tv - با برد آردوینو و تگ RFID دستگاه حضور و غیاب بسازید



Admin Logo
themebox Logo



تاریخ:دوشنبه 12 تیر 1396-08:06 ب.ظ

نویسنده :بهترین وبلاگ Ž

با برد آردوینو و تگ RFID دستگاه حضور و غیاب بسازید



مفیدستان:

#include <Wire.h>

#include <SPI.h>

#include <SD.h>

#include <RTClib.h>

#include <LiquidCrystal.h>

String tag[2]=

“۵۴۵۴۴۸۴۸۵۳۶۹۵۶۶۶۶۶۵۲”,“۵۴۵۴۴۸۴۸۵۳۶۹۵۶۶۹۵۷۵۱”;

String name[2]=

“Rahul Kar”,“Engineers Garage”;

String roll[2]=

“۲۰۱۳۰۱۷۴”,“۲۰۱۳۰۲۰۷”;

const int chipSelect=10;

int val=0,n=2;

int bytesread=0;

int buttonState=0;

String gettag=String();

char filename[]=“00000000.CSV”;

RTC_DS1307 RTC;

LiquidCrystal lcd(9,8,7,6,5,4);

void setup()

Serial.begin(9600); // RFID reader SOUT pin connected to Serial RX pin at 9600bps

lcd.begin(16,2);

Wire.begin(); // Initiate I2C

RTC.begin(); // Initiate RTC

pinMode(2,OUTPUT); // Set digital pin 2 as OUTPUT to connect it to the RFID /ENABLE pin

digitalWrite(2,HIGH); // Activate the RFID reader

//Serial.print(“Initializing SD card…”);

pinMode(10,OUTPUT); // ۵۳ for Mega 10 for UNO

if(!SD.begin(chipSelect)) // See if the card is present and can be initialized

//Serial.println(“Card failed, or not present”);

return;

delay(100);

//Serial.println(“Card initialized.”);

if(!RTC.isrunning())

//Serial.println(“RTC is NOT running!”);

char filename[]=“00000000.CSV”;

void getFilename(char *filename)

DateTime now=RTC.now();

int year=now.year();

int month=now.month();

int day=now.day();

filename[0]=‘2’;

filename[1]=‘0’;

filename[2]=(year2000)/10+‘0’;

filename[3]=year%10+‘0’;

filename[4]=month/10+‘0’;

filename[5]=month%10+‘0’;

filename[6]=day/10+‘0’;

filename[7]=day%10+‘0’;

filename[8]=‘.’;

filename[9]=‘C’;

filename[10]=‘S’;

filename[11]=‘V’;

return;

void printdate_time()

DateTime now=RTC.now();

lcd.setCursor(0,1); // set column zero row 2

lcd.print(“Time”); // display the word “time”

lcd.setCursor(5,1); // set column 5 row 2

lcd.print(now.hour(),DEC); // display hour

lcd.setCursor(7,1); // set column 7 row 2

lcd.print(‘:’); // display colon

lcd.setCursor(8,1); // set column 8 row 2

lcd.print(now.minute(),DEC); // display minute

lcd.setCursor(10,1); // set column 9 row 2

lcd.print(‘:’); // display colon

lcd.setCursor(11,1); // set column 11 row 2

lcd.print(now.second(), DEC); // display seconds

// display DATE on FIRST ROW

lcd.setCursor(0, 0); // set column zero row 1

lcd.print(“Date”); // display the word “Date”

lcd.setCursor(5, 0); // set column 5 row 1

lcd.print(now.month(), DEC); // display current month

lcd.setCursor(7, 0); // set column 7 row 1

lcd.print(‘/’); // display forwared slash

lcd.setCursor(8, 0); // set column 8 row 1

lcd.print(now.day(), DEC); // display current day

lcd.setCursor(10, 0); // set column 10 row 1

lcd.print(‘/’); // display forward slash

lcd.setCursor(11, 0); // set column 11 row 1

lcd.print(now.year(), DEC); // print current year

void printdata(String name,String roll)

lcd.clear();

lcd.print(name);

lcd.setCursor(0,1);

lcd.print(roll);

delay(800);

lcd.clear();

printdate_time();

String getname(String t)

int index=0;

for(int i=0;i<n;i++)

if(t.equals(tag[i]))

index=i;

break;

return name[index];

String getroll(String t)

int index=0;

for(int i=0;i<n;i++)

if(t.equals(tag[i]))

index=i;

break;

return roll[index];

void readtag_dumpSD()

{

if(Serial.available()>0) // if data available from reader

{

if((val=Serial.read())==10) // check for header

bytesread=0;

while(bytesread<10) // read 10 digit code

if(Serial.available()>0)

(val==13)) // if header or stop bytes before the 10 digit reading

break; // stop reading

gettag=gettag+val; // add the digit

bytesread++; // ready to read next digit

if(bytesread==10) // if 10 digit read is complete

DateTime now=RTC.now();

String stu=getname(gettag); //Get student name

String rol=getroll(gettag); //Get student roll..

digitalWrite(2, LOW); // deactivate the RFID reader for a moment so it will not flood

delay(1500); // wait for a bit

digitalWrite(2, HIGH); // Activate the RFID reader

getFilename(filename);

if(!SD.exists(filename)) //If filename doesnt exist create one

File dataFile=SD.open(filename,FILE_WRITE);

if(dataFile)

dataFile.print(“Name”);

dataFile.print(“,”);

dataFile.print(“Roll”);

dataFile.print(“,”);

dataFile.print(“Time”);

dataFile.println();

dataFile.print(stu);

dataFile.print(“,”);

dataFile.print(rol);

dataFile.print(“,”);

dataFile.print(now.hour());

dataFile.print(“:”);

dataFile.print(now.minute());

dataFile.print(“:”);

dataFile.print(now.second());

dataFile.println();

dataFile.close();

printdata(stu,rol);

else if(SD.exists(filename)) //If filename exist then use it

File dataFile=SD.open(filename,FILE_WRITE);

if(dataFile)

dataFile.print(stu);

dataFile.print(“,”);

dataFile.print(rol);

dataFile.print(“,”);

dataFile.print(now.hour());

dataFile.print(“:”);

dataFile.print(now.minute());

dataFile.print(“:”);

dataFile.print(now.second());

dataFile.println();

dataFile.close();

printdata(stu,rol);

else // if the file isn’t open, pop up an error:

//Serial.println(“Error opening file”);

bytesread=0;

digitalWrite(2, LOW); // deactivate the RFID reader for a moment so it will not flood

delay(1500); // wait for a bit

digitalWrite(2, HIGH); // Activate the RFID reader

gettag=NULL;

}

}

void loop()

printdate_time();

readtag_dumpSD();



لینک منبع

بازنشر: مفیدستان

مطلب با برد آردوینو و تگ RFID دستگاه حضور و غیاب بسازید در سایت مفیدستان
برای دریافت مطالب مفید به سایت مفیدستان مراجعه فرمایید.


لینک منبع و پست :با برد آردوینو و تگ RFID دستگاه حضور و غیاب بسازید
http://mofidestan.ir/%d8%a8%d8%a7-%d8%a8%d8%b1%d8%af-%d8%a2%d8%b1%d8%af%d9%88%db%8c%d9%86%d9%88-%d9%88-%d8%aa%da%af-rfid-%d8%af%d8%b3%d8%aa%da%af%d8%a7%d9%87-%d8%ad%d8%b6%d9%88%d8%b1-%d9%88-%d8%ba%db%8c%d8%a7%d8%a8-%d8%a8/

نظرات() 
gesundes abnehmen
شنبه 26 آبان 1397 12:37 ق.ظ
Howdy are using Wordpress for your blog platform?
I'm new to the blog world but I'm trying to get started and set up my own. Do you need any html coding knowledge to
make your own blog? Any help would be really appreciated!
die besten pillen
جمعه 25 آبان 1397 11:19 ب.ظ
Every weekend i used to go to see this web site, as i
wish for enjoyment, for the reason that this this website conations in fact fastidious funny material too.
diätpillen im test 2018
جمعه 25 آبان 1397 07:30 ب.ظ
Very nice post. I just stumbled upon your blog and wanted to mention that I
have truly enjoyed surfing around your weblog posts. In any case
I'll be subscribing to your rss feed and I am hoping you write again very
soon!
the new 222 led canbus bulb
جمعه 25 آبان 1397 01:53 ب.ظ
I was wondering if you ever considered changing the layout of your website? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having 1 or two pictures. Maybe you could space it out better?
Abnehmen Fettverbrennung Tabletten
جمعه 25 آبان 1397 02:35 ق.ظ
Why users still use to read news papers when in this technological world all is existing on web?
pillen zum abnehmen die wirklich helfen
پنجشنبه 24 آبان 1397 03:21 ب.ظ
Simply want to say your article is as amazing. The
clearness for your put up is simply cool and i could think you're knowledgeable on this
subject. Fine along with your permission allow me to grasp your feed to keep up to date with
approaching post. Thank you one million and please continue the rewarding work.
Fett tabletten abnehmen
پنجشنبه 24 آبان 1397 01:18 ب.ظ
Hey I know this is off topic but I was wondering if you knew of any widgets I could add to my blog
that automatically tweet my newest twitter updates. I've been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience
with something like this. Please let me know if you run into anything.
I truly enjoy reading your blog and I look forward to your new updates.
https://www.getjar.com/categories/all-games/action-games/Rules-of-Survival-Cheat-960889
پنجشنبه 24 آبان 1397 05:51 ق.ظ
Hello. i like the way you post on your blog.
where to get good cosplay costumes? UK?
چهارشنبه 23 آبان 1397 02:46 ب.ظ
Hi there! This post couldn't be written any better! Reading through this
article reminds me of my previous roommate!
He constantly kept preaching about this. I most certainly will forward this information to him.
Fairly certain he'll have a good read. Many thanks for sharing!
Get Paid To Test Apps
دوشنبه 21 آبان 1397 09:28 ق.ظ
How would you like to get paid to test apps? You can and
it’s super simple. Just visit http://bit.ly/2FfjVJi and follow
the directions. You’ll be getting paid to test
apps in a matter of no time.
cosplay costumes
یکشنبه 20 آبان 1397 07:32 ب.ظ
Hi there, always i used to check website posts here early
in the morning, because i like to gain knowledge of more and more.
Drop Shipping Guide
یکشنبه 20 آبان 1397 01:53 ق.ظ
Have you been wanting to get into the world of drop shipping,
but didn’t know where to start? This guide http://destyy.com/wXm77T will show you how to get started.
It’ll teach you where to buy all the stuff that can be sold for super high
profits.
Easy eBay Money
شنبه 19 آبان 1397 03:31 ب.ظ
Have you ever dreamed of making money on eBay? It’s not as difficult as you may think.

All you have to do is follow this simple guide.
Click on the link http://destyy.com/wXQthB and begin your journey to eBay riches.
cosplay costumes that look just like the real character
شنبه 19 آبان 1397 04:38 ق.ظ
Hey I know this is off topic but I was wondering if you knew of any widgets
I could add to my blog that automatically tweet my
newest twitter updates. I've been looking for a plug-in like this for quite some time and was hoping
maybe you would have some experience with something like this.

Please let me know if you run into anything.
I truly enjoy reading your blog and I look forward to your new updates.
Video game testers needed
جمعه 18 آبان 1397 12:58 ب.ظ
Did you know that it’s possible to make money testing video games?
You’re going to flip your lid when you see this
http://j.gs/Brq4 Click that link and start making money testing video games!
12 Volt Automotive CANbus Led Lights
پنجشنبه 17 آبان 1397 10:11 ق.ظ
Marvelous, what a website it is! This weblog provides helpful data to us, keep it up.
12 volt automotive led turn signal lights
پنجشنبه 17 آبان 1397 06:28 ق.ظ
Wow, awesome weblog layout! How lengthy have you ever been running a blog for? you make blogging look easy. The full look of your site is excellent, let alone the content
12 volt automotive led lights
شنبه 12 آبان 1397 08:11 ق.ظ
I every time spent my half an hour to read this webpage's articles all the time along with a mug of coffee.
12 volt auto led lights
جمعه 11 آبان 1397 01:46 ب.ظ
I constantly spent my half an hour to read this webpage's articles all the time along with a mug of coffee.
vitamine per la crescita dei capelli
سه شنبه 8 آبان 1397 05:21 ب.ظ
My programmer is trying to persuade me to move to .net from PHP.

I have always disliked the idea because of the expenses.

But he's tryiong none the less. I've been using Movable-type on a variety of
websites for about a year and am worried about switching to another platform.
I have heard excellent things about blogengine.net.
Is there a way I can import all my wordpress content into it?
Any kind of help would be greatly appreciated!
vitamine per la crescita dei capelli
سه شنبه 8 آبان 1397 02:13 ب.ظ
Hi outstanding website! Does running a blog similar to this
require a great deal of work? I have very little knowledge of
programming but I was hoping to start my own blog soon. Anyway, should you have any suggestions
or techniques for new blog owners please share.
I understand this is off topic but I just had to ask.
Thanks a lot!
Vitamine FüR Das Haarausfall
سه شنبه 8 آبان 1397 01:48 ب.ظ
What's up all, here every one is sharing such know-how, thus it's fastidious to
read this blog, and I used to go to see this website all the time.
vitamine per capelli
سه شنبه 8 آبان 1397 01:19 ب.ظ
I just couldn't leave your web site prior to
suggesting that I really loved the standard information a
person provide for your guests? Is gonna be again often to check
up on new posts
Haar Vitamine
سه شنبه 8 آبان 1397 10:02 ق.ظ
After I initially commented I appear to have clicked on the -Notify me when new comments are
added- checkbox and now every time a comment is added
I receive 4 emails with the same comment. Is there a way you are able to remove me from that service?
Cheers!
vitamine per capelli
سه شنبه 8 آبان 1397 09:13 ق.ظ
Hi there, I would like to subscribe for this weblog
to take latest updates, so where can i do it please assist.
vitamine contro la caduta dei capelli
سه شنبه 8 آبان 1397 07:10 ق.ظ
An impressive share! I've just forwarded this
onto a colleague who was conducting a little research on this.
And he actually ordered me lunch because I stumbled upon it for him...

lol. So let me reword this.... Thanks for the
meal!! But yeah, thanks for spending some time to discuss this subject here on your website.
haar vitamine
سه شنبه 8 آبان 1397 02:10 ق.ظ
Excellent post! We will be linking to this particularly great article
on our website. Keep up the good writing.
Free auto approve list 10-17-2018
دوشنبه 30 مهر 1397 02:01 ق.ظ
There’s been a lot of changes since I last left
a comment about my site. I’m starting to add the new features that I’ve wanted to.
I hope in the next few weeks that all of it will be up and running.

It’s going to take time and I haven’t had much of it to dedicate
to this project. I thank you all for visiting my site and
I hope you have a great weekend!
Cialis prices
دوشنبه 9 مهر 1397 10:11 ب.ظ

Superb information. Cheers!
cialis name brand cheap prices for cialis 50mg viagra or cialis cialis prices we like it cialis soft gel trusted tabled cialis softabs cialis vs viagra tadalafil 10 mg cialis professional from usa buy cialis cheap 10 mg
discount canadian pharmacies
یکشنبه 1 مهر 1397 06:17 ب.ظ

You've made the point.
canada medication canadian pharmacy viagra online pharmacies in usa online pharmacy are canadian online pharmacies safe canadian pharmacies that are legit prescription drugs without prior prescription drugs for sale on internet pharmacy onesource drugstore online
 
لبخندناراحتچشمک
نیشخندبغلسوال
قلبخجالتزبان
ماچتعجبعصبانی
عینکشیطانگریه
خندهقهقههخداحافظ
سبزقهرهورا
دستگلتفکر



نمایش نظرات 1 تا 30