|
| 1 | +/* |
| 2 | + * A simple example to interface with rdm6300 rfid reader using AltSoftSerial. |
| 3 | + * We use AltSoftSerial uart instead of the default software uart driver. |
| 4 | + * |
| 5 | + * Connections: |
| 6 | + * | Board | RX Pin | PWM Unusable | Pin Unusable | |
| 7 | + * |------------------+--------+--------------+--------------| |
| 8 | + * | Teensy 3.0 & 3.1 | 20 | 22 | 21 | |
| 9 | + * | Teensy 2.0 | 10 | - | 9 | |
| 10 | + * | Teensy++ 2.0 | 4 | 26, 27 | 25 | |
| 11 | + * | Arduino Uno | 8 | 10 | 9 | |
| 12 | + * | Arduino Leonardo | 13 | - | 5 | |
| 13 | + * | Arduino Mega | 48 | 44, 45 | 46 | |
| 14 | + * | Wiring-S | 6 | 4 | 5 | |
| 15 | + * | Sanguino | 14 | 12 | 13 | |
| 16 | + * |
| 17 | + * Arad Eizen (https://github.com/arduino12) 08/05/19, 09/06/19, 22/06/19. |
| 18 | + */ |
| 19 | + |
| 20 | +#include <rdm6300.h> |
| 21 | +#include <AltSoftSerial.h> |
| 22 | + |
| 23 | +#define RDM6300_RX_PIN 8 |
| 24 | +#define READ_LED_PIN 13 |
| 25 | + |
| 26 | +Rdm6300 rdm6300; |
| 27 | +AltSoftSerial alt_soft_serial; |
| 28 | + |
| 29 | + |
| 30 | +void setup() |
| 31 | +{ |
| 32 | + Serial.begin(115200); |
| 33 | + |
| 34 | + pinMode(READ_LED_PIN, OUTPUT); |
| 35 | + digitalWrite(READ_LED_PIN, LOW); |
| 36 | + |
| 37 | + alt_soft_serial.begin(RDM6300_BAUDRATE); |
| 38 | + rdm6300.begin(&alt_soft_serial); |
| 39 | + |
| 40 | + Serial.println("\nPlace RFID tag near the rdm6300..."); |
| 41 | +} |
| 42 | + |
| 43 | +void loop() |
| 44 | +{ |
| 45 | + /* if non-zero tag_id, update() returns true- a new tag is near! */ |
| 46 | + if (rdm6300.update()) |
| 47 | + Serial.println(rdm6300.get_tag_id(), HEX); |
| 48 | + |
| 49 | + digitalWrite(READ_LED_PIN, rdm6300.is_tag_near()); |
| 50 | + |
| 51 | + delay(10); |
| 52 | +} |
0 commit comments