Modificacion de https://mbed.org/cookbook/RFID-Tweeter para soporte de un tag no enlistado y registro del mismo mediante twiter
Dependencies: EthernetNetIf HTTPClient_ToBeRemoved mbed
ID12RFID/ID12RFID.h@0:8df845fb13c7, 2012-10-28 (annotated)
- Committer:
- sherckuith
- Date:
- Sun Oct 28 04:49:16 2012 +0000
- Revision:
- 0:8df845fb13c7
Modificacion de https://mbed.org/cookbook/RFID-Tweeter para soporte de un tag no valido y registro en twiter.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sherckuith | 0:8df845fb13c7 | 1 | /* mbed ID12 RFID Library |
sherckuith | 0:8df845fb13c7 | 2 | * Copyright (c) 2007-2010, sford, http://mbed.org |
sherckuith | 0:8df845fb13c7 | 3 | * |
sherckuith | 0:8df845fb13c7 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
sherckuith | 0:8df845fb13c7 | 5 | * of this software and associated documentation files (the "Software"), to deal |
sherckuith | 0:8df845fb13c7 | 6 | * in the Software without restriction, including without limitation the rights |
sherckuith | 0:8df845fb13c7 | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
sherckuith | 0:8df845fb13c7 | 8 | * copies of the Software, and to permit persons to whom the Software is |
sherckuith | 0:8df845fb13c7 | 9 | * furnished to do so, subject to the following conditions: |
sherckuith | 0:8df845fb13c7 | 10 | * |
sherckuith | 0:8df845fb13c7 | 11 | * The above copyright notice and this permission notice shall be included in |
sherckuith | 0:8df845fb13c7 | 12 | * all copies or substantial portions of the Software. |
sherckuith | 0:8df845fb13c7 | 13 | * |
sherckuith | 0:8df845fb13c7 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
sherckuith | 0:8df845fb13c7 | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
sherckuith | 0:8df845fb13c7 | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
sherckuith | 0:8df845fb13c7 | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
sherckuith | 0:8df845fb13c7 | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
sherckuith | 0:8df845fb13c7 | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
sherckuith | 0:8df845fb13c7 | 20 | * THE SOFTWARE. |
sherckuith | 0:8df845fb13c7 | 21 | */ |
sherckuith | 0:8df845fb13c7 | 22 | |
sherckuith | 0:8df845fb13c7 | 23 | #ifndef MBED_ID12RFID_H |
sherckuith | 0:8df845fb13c7 | 24 | #define MBED_ID12RFID_H |
sherckuith | 0:8df845fb13c7 | 25 | |
sherckuith | 0:8df845fb13c7 | 26 | #include "mbed.h" |
sherckuith | 0:8df845fb13c7 | 27 | |
sherckuith | 0:8df845fb13c7 | 28 | /** An interface for the ID-12 RFID reader device |
sherckuith | 0:8df845fb13c7 | 29 | * |
sherckuith | 0:8df845fb13c7 | 30 | * @code |
sherckuith | 0:8df845fb13c7 | 31 | * // Print RFID tag numbers |
sherckuith | 0:8df845fb13c7 | 32 | * |
sherckuith | 0:8df845fb13c7 | 33 | * #include "mbed.h" |
sherckuith | 0:8df845fb13c7 | 34 | * #include "ID12RFID.h" |
sherckuith | 0:8df845fb13c7 | 35 | * |
sherckuith | 0:8df845fb13c7 | 36 | * ID12RFID rfid(p10); // serial rx |
sherckuith | 0:8df845fb13c7 | 37 | * |
sherckuith | 0:8df845fb13c7 | 38 | * int main() { |
sherckuith | 0:8df845fb13c7 | 39 | * while(1) { |
sherckuith | 0:8df845fb13c7 | 40 | * if(rfid.readable()) { |
sherckuith | 0:8df845fb13c7 | 41 | * printf("RFID Tag number : %d\n", rfid.read()); |
sherckuith | 0:8df845fb13c7 | 42 | * } |
sherckuith | 0:8df845fb13c7 | 43 | * } |
sherckuith | 0:8df845fb13c7 | 44 | * } |
sherckuith | 0:8df845fb13c7 | 45 | * @endcode |
sherckuith | 0:8df845fb13c7 | 46 | */ |
sherckuith | 0:8df845fb13c7 | 47 | class ID12RFID { |
sherckuith | 0:8df845fb13c7 | 48 | |
sherckuith | 0:8df845fb13c7 | 49 | public: |
sherckuith | 0:8df845fb13c7 | 50 | /** Create an ID12 RFID interface, connected to the specified Serial rx port |
sherckuith | 0:8df845fb13c7 | 51 | * |
sherckuith | 0:8df845fb13c7 | 52 | * @param rx Recieve pin |
sherckuith | 0:8df845fb13c7 | 53 | */ |
sherckuith | 0:8df845fb13c7 | 54 | ID12RFID(PinName rx); |
sherckuith | 0:8df845fb13c7 | 55 | |
sherckuith | 0:8df845fb13c7 | 56 | /** Non blocking function to determine if an ID has been received |
sherckuith | 0:8df845fb13c7 | 57 | * |
sherckuith | 0:8df845fb13c7 | 58 | * @return Non zero value when the device is readable |
sherckuith | 0:8df845fb13c7 | 59 | */ |
sherckuith | 0:8df845fb13c7 | 60 | int readable(); |
sherckuith | 0:8df845fb13c7 | 61 | |
sherckuith | 0:8df845fb13c7 | 62 | /** A blocking function that will return a tag ID when available |
sherckuith | 0:8df845fb13c7 | 63 | * |
sherckuith | 0:8df845fb13c7 | 64 | * @return The ID tag value |
sherckuith | 0:8df845fb13c7 | 65 | */ |
sherckuith | 0:8df845fb13c7 | 66 | int read(); |
sherckuith | 0:8df845fb13c7 | 67 | |
sherckuith | 0:8df845fb13c7 | 68 | private: |
sherckuith | 0:8df845fb13c7 | 69 | Serial _rfid; |
sherckuith | 0:8df845fb13c7 | 70 | |
sherckuith | 0:8df845fb13c7 | 71 | }; |
sherckuith | 0:8df845fb13c7 | 72 | |
sherckuith | 0:8df845fb13c7 | 73 | #endif |