wiki:Example3

Examples

Example 3

Read rfid tag (if any) and blink according to which tag was there.

example3/main.c:

#include <all.h>

int
main(void) 
{
        /* initialize devices */
        init_all();

        rfid_enable();

        rfid_t rfid_data;

        while(1) {

                while(rfid_get_data(rfid_data) != RFID_RETURN_SUCCESS);

                if(rfid_cmp_tag_constant(rfid_data, RFID_TAG_1)) {
                        led_on(FRONT);
                } else if(rfid_cmp_tag_constant(rfid_data, RFID_TAG_2)) {
                        led_on(RIGHT);
                } else {
                        led_on(LEFT);
                }
                delay_ms(2000);

                led_off(ANYDIR);
        }

        return 0;
}
Last modified 7 years ago Last modified on Nov 23, 2011, 11:24:33 AM