RFID communications by wire

Dependencies:   ID12RFID mbed

.

main.cpp

Committer:
codabash
Date:
2013-05-02
Revision:
0:b130c91c1af4

File content as of revision 0:b130c91c1af4:

#include "mbed.h"
#include "ID12RFID.h"

Serial pc(USBTX, USBRX);
ID12RFID rfid(PTD2); // uart rx
Serial talky(PTC4, PTC3);

DigitalOut l1(LED1);
DigitalOut l2(LED2);
DigitalOut l3(LED3);



int main() {
l1=1;
l2=1;
l3=1;

    pc.printf("\r Hello BEAUTIFUL!\n");
    while(1) {
    
        if(rfid.readable()&& talky.writeable()) {
            int c=rfid.read();
            l2=1;
            l1=!l1;
            wait(0.01);
            pc.printf("\r RFID Tag number : %d\n", c);        
               
//               l1=!l1;
               talky.printf("%d\r ", c);
                wait(0.1);
//            l1=!l1;
            l1=!l1;
        }
        else { 
        l1=1;l2=0;}
    }
}
//
//DigitalOut l1(LED1);
//DigitalOut l2(LED2);
//DigitalOut l3(LED3);
//
//
//int main() {
//
//l1=1;
//l2=1;
//l3=1;
//    while(1) {
//    if (pc.readable() && talky.writeable()){
//    char c = pc.getc();
//    l1=!l1;
//    talky.putc(c);
//    wait(0.01);
//    l1=!l1;
//    }
//    if (talky.readable() && pc.writeable()){
//    l2=!l2;
//    char c2 = talky.getc();
//    wait(0.01);
//    l2=!l2;
//    pc.putc(c2);
//        }  
//    wait(0.01);
//    }
//}