Library for the Robotics RedBee™RFID Reader.
readme.md@1:63229f10d6e0, 2021-11-10 (annotated)
- Committer:
- Sebastien Prouff
- Date:
- Wed Nov 10 16:48:19 2021 +0100
- Revision:
- 1:63229f10d6e0
Feature : add documentation
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Sebastien Prouff |
1:63229f10d6e0 | 1 | # Librairie Robotics_RFID_Reader |
Sebastien Prouff |
1:63229f10d6e0 | 2 | |
Sebastien Prouff |
1:63229f10d6e0 | 3 | ## Import library |
Sebastien Prouff |
1:63229f10d6e0 | 4 | |
Sebastien Prouff |
1:63229f10d6e0 | 5 | ```shell |
Sebastien Prouff |
1:63229f10d6e0 | 6 | mbed add http://os.mbed.com/users/sepro/code/Grove-RFID-Reader/ |
Sebastien Prouff |
1:63229f10d6e0 | 7 | ``` |
Sebastien Prouff |
1:63229f10d6e0 | 8 | |
Sebastien Prouff |
1:63229f10d6e0 | 9 | |
Sebastien Prouff |
1:63229f10d6e0 | 10 | |
Sebastien Prouff |
1:63229f10d6e0 | 11 | |
Sebastien Prouff |
1:63229f10d6e0 | 12 | |
Sebastien Prouff |
1:63229f10d6e0 | 13 | # Class documentation |
Sebastien Prouff |
1:63229f10d6e0 | 14 | |
Sebastien Prouff |
1:63229f10d6e0 | 15 | ### public members |
Sebastien Prouff |
1:63229f10d6e0 | 16 | |
Sebastien Prouff |
1:63229f10d6e0 | 17 | **Constructor RoboticsRfid** |
Sebastien Prouff |
1:63229f10d6e0 | 18 | |
Sebastien Prouff |
1:63229f10d6e0 | 19 | ```c++ |
Sebastien Prouff |
1:63229f10d6e0 | 20 | RoboticsRfidReader(PinName Tx, PinName Rx); |
Sebastien Prouff |
1:63229f10d6e0 | 21 | ``` |
Sebastien Prouff |
1:63229f10d6e0 | 22 | |
Sebastien Prouff |
1:63229f10d6e0 | 23 | **Non blockin line reading on serial. '\n' for End Of Line.** |
Sebastien Prouff |
1:63229f10d6e0 | 24 | |
Sebastien Prouff |
1:63229f10d6e0 | 25 | ```c++ |
Sebastien Prouff |
1:63229f10d6e0 | 26 | bool rfidRead(unsigned char *tampon) |
Sebastien Prouff |
1:63229f10d6e0 | 27 | ``` |
Sebastien Prouff |
1:63229f10d6e0 | 28 | |
Sebastien Prouff |
1:63229f10d6e0 | 29 | ### Private attributes |
Sebastien Prouff |
1:63229f10d6e0 | 30 | |
Sebastien Prouff |
1:63229f10d6e0 | 31 | ``` |
Sebastien Prouff |
1:63229f10d6e0 | 32 | UnbufferedSerial **_rfid** |
Sebastien Prouff |
1:63229f10d6e0 | 33 | ``` |
Sebastien Prouff |
1:63229f10d6e0 | 34 | |
Sebastien Prouff |
1:63229f10d6e0 | 35 | ``` |
Sebastien Prouff |
1:63229f10d6e0 | 36 | unsigned char **_c** |
Sebastien Prouff |
1:63229f10d6e0 | 37 | ``` |
Sebastien Prouff |
1:63229f10d6e0 | 38 | |
Sebastien Prouff |
1:63229f10d6e0 | 39 | |
Sebastien Prouff |
1:63229f10d6e0 | 40 | |
Sebastien Prouff |
1:63229f10d6e0 | 41 | ### Description |
Sebastien Prouff |
1:63229f10d6e0 | 42 | |
Sebastien Prouff |
1:63229f10d6e0 | 43 | Example |
Sebastien Prouff |
1:63229f10d6e0 | 44 | |
Sebastien Prouff |
1:63229f10d6e0 | 45 | ```c++ |
Sebastien Prouff |
1:63229f10d6e0 | 46 | #define ID_BADGE "1 7 221 87 161" |
Sebastien Prouff |
1:63229f10d6e0 | 47 | RoboticsRfidReader myRfid(D1, D0); |
Sebastien Prouff |
1:63229f10d6e0 | 48 | |
Sebastien Prouff |
1:63229f10d6e0 | 49 | int main() { |
Sebastien Prouff |
1:63229f10d6e0 | 50 | unsigned char buffer[30]; |
Sebastien Prouff |
1:63229f10d6e0 | 51 | bool lineRead; |
Sebastien Prouff |
1:63229f10d6e0 | 52 | while (true) { |
Sebastien Prouff |
1:63229f10d6e0 | 53 | lineRead = myRfid.rfidRead(buffer); |
Sebastien Prouff |
1:63229f10d6e0 | 54 | if (lineRead) { |
Sebastien Prouff |
1:63229f10d6e0 | 55 | printf("buffer : %s", buffer); |
Sebastien Prouff |
1:63229f10d6e0 | 56 | printf("\r\n"); |
Sebastien Prouff |
1:63229f10d6e0 | 57 | if (strstr((char *)tampon, ID_BADGE))) { |
Sebastien Prouff |
1:63229f10d6e0 | 58 | printf("OK \r\n"); |
Sebastien Prouff |
1:63229f10d6e0 | 59 | } else { |
Sebastien Prouff |
1:63229f10d6e0 | 60 | printf("NOK \r\n"); |
Sebastien Prouff |
1:63229f10d6e0 | 61 | } |
Sebastien Prouff |
1:63229f10d6e0 | 62 | } |
Sebastien Prouff |
1:63229f10d6e0 | 63 | } |
Sebastien Prouff |
1:63229f10d6e0 | 64 | ``` |
Sebastien Prouff |
1:63229f10d6e0 | 65 |