Closed StephaneCYB closed 3 years ago
This library does not use Serial or any other IO pin other than the pair declared with wg.begin
Thanks for your reply. I noticed that the PinChangeInterrupt is not compatible with SoftSerial. So I think that it is impossible to use the serial port, with the WiegandMulti. Do you think this is correct, or do you have any examples using TX & RX ?
I am a bit confused, I didn't see anywhere in your code SoftSerial is being used.
SoftSerial has lots of issues, you should avoid using it for multiple hardware that uses interrupts.
From your sketch, it looks like you are using hardware serial, with hardware serial it should work. Only thing that you can't just print things to the "Arduino Serial Monitor" that will be conflicting with MODBUS.
Nano is cheap, why not use two nano boards, one for Wiegand and one for MODBUS, then the two can communicate using I2C ?
I think I tested now all libraries Modbus and Wiegand. Separately this libraries are working perfect, but modbus is not functional, when a wiegand library is implemented. I suppose that both libraries are using the same interrupt, or something else commonly. Using 2 nano boards, using I2C looks a solution, but I don't have the place to mount the 2 units in the box of a light switch. (including light switch). Because Serial.println instruction seems to work, I think to use this to send the codes to our PLC.
Hi,
I use the WiegandMulti.h to read the codes from a Wiegand keyboard with NFC reader. This works perfect to the serial monitor. I connected the Wiegand D0 & D1 to pin D5 &D6 of a nano. Now I like to make the nano also a modbus RTU slave, to make the codes available for a modbus master. I use always the older version SimpleModbusSlave, because this library is easy to use. SimpleModbusSlave is using RX,TX and D2 of the nano for serial communication to RS485.
Is the WiegandMulti library, using D2 and/or the communication lines of the nano when there is no output to the serial monitor ?
Here the sketch that I use