RFID communications by wire

Dependencies:   ID12RFID mbed

.

Committer:
codabash
Date:
Thu May 02 10:22:05 2013 +0000
Revision:
0:b130c91c1af4
1st go.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
codabash 0:b130c91c1af4 1 #include "mbed.h"
codabash 0:b130c91c1af4 2 #include "ID12RFID.h"
codabash 0:b130c91c1af4 3
codabash 0:b130c91c1af4 4 Serial pc(USBTX, USBRX);
codabash 0:b130c91c1af4 5 ID12RFID rfid(PTD2); // uart rx
codabash 0:b130c91c1af4 6 Serial talky(PTC4, PTC3);
codabash 0:b130c91c1af4 7
codabash 0:b130c91c1af4 8 DigitalOut l1(LED1);
codabash 0:b130c91c1af4 9 DigitalOut l2(LED2);
codabash 0:b130c91c1af4 10 DigitalOut l3(LED3);
codabash 0:b130c91c1af4 11
codabash 0:b130c91c1af4 12
codabash 0:b130c91c1af4 13
codabash 0:b130c91c1af4 14 int main() {
codabash 0:b130c91c1af4 15 l1=1;
codabash 0:b130c91c1af4 16 l2=1;
codabash 0:b130c91c1af4 17 l3=1;
codabash 0:b130c91c1af4 18
codabash 0:b130c91c1af4 19 pc.printf("\r Hello BEAUTIFUL!\n");
codabash 0:b130c91c1af4 20 while(1) {
codabash 0:b130c91c1af4 21
codabash 0:b130c91c1af4 22 if(rfid.readable()&& talky.writeable()) {
codabash 0:b130c91c1af4 23 int c=rfid.read();
codabash 0:b130c91c1af4 24 l2=1;
codabash 0:b130c91c1af4 25 l1=!l1;
codabash 0:b130c91c1af4 26 wait(0.01);
codabash 0:b130c91c1af4 27 pc.printf("\r RFID Tag number : %d\n", c);
codabash 0:b130c91c1af4 28
codabash 0:b130c91c1af4 29 // l1=!l1;
codabash 0:b130c91c1af4 30 talky.printf("%d\r ", c);
codabash 0:b130c91c1af4 31 wait(0.1);
codabash 0:b130c91c1af4 32 // l1=!l1;
codabash 0:b130c91c1af4 33 l1=!l1;
codabash 0:b130c91c1af4 34 }
codabash 0:b130c91c1af4 35 else {
codabash 0:b130c91c1af4 36 l1=1;l2=0;}
codabash 0:b130c91c1af4 37 }
codabash 0:b130c91c1af4 38 }
codabash 0:b130c91c1af4 39 //
codabash 0:b130c91c1af4 40 //DigitalOut l1(LED1);
codabash 0:b130c91c1af4 41 //DigitalOut l2(LED2);
codabash 0:b130c91c1af4 42 //DigitalOut l3(LED3);
codabash 0:b130c91c1af4 43 //
codabash 0:b130c91c1af4 44 //
codabash 0:b130c91c1af4 45 //int main() {
codabash 0:b130c91c1af4 46 //
codabash 0:b130c91c1af4 47 //l1=1;
codabash 0:b130c91c1af4 48 //l2=1;
codabash 0:b130c91c1af4 49 //l3=1;
codabash 0:b130c91c1af4 50 // while(1) {
codabash 0:b130c91c1af4 51 // if (pc.readable() && talky.writeable()){
codabash 0:b130c91c1af4 52 // char c = pc.getc();
codabash 0:b130c91c1af4 53 // l1=!l1;
codabash 0:b130c91c1af4 54 // talky.putc(c);
codabash 0:b130c91c1af4 55 // wait(0.01);
codabash 0:b130c91c1af4 56 // l1=!l1;
codabash 0:b130c91c1af4 57 // }
codabash 0:b130c91c1af4 58 // if (talky.readable() && pc.writeable()){
codabash 0:b130c91c1af4 59 // l2=!l2;
codabash 0:b130c91c1af4 60 // char c2 = talky.getc();
codabash 0:b130c91c1af4 61 // wait(0.01);
codabash 0:b130c91c1af4 62 // l2=!l2;
codabash 0:b130c91c1af4 63 // pc.putc(c2);
codabash 0:b130c91c1af4 64 // }
codabash 0:b130c91c1af4 65 // wait(0.01);
codabash 0:b130c91c1af4 66 // }
codabash 0:b130c91c1af4 67 //}