How to use the UART on the DFR0334 GPIO shield?
![userHead](https://dfimg.dfrobot.com/dfPortrait2.png)
I have a project whereby two to four Arduino UNO's will be controlling a model bus lay-out on my model train lay-out. The buses are self driving (have an on-board battery) and are controlled by small magnets in the road surface. E.g. when you put a magnet in the driving path of the bus, it will stop. If you move the magnet away, the bus will move on. The bus follows an iron wire in the road surface using a magnet that is connected to and move the steering wheels. The system will detect a bus with a Hall sensor that detects this steering magnet.
The magnets in the road surface (to start and stop a bus) are on the arm of a servo. This allows me to control the buses movement by controlling these servo's. I also use servo's to operate turn-outs to let the buses change course.
The buses are controlled using a sort of block system whereby a bus can only move on when the next block is vacant.
So I now have 2 Arduino's (because of distance and number of I/O needed) that need to share block occupancy data. I used the DFR0334 GPIO shield because it makes the connection of the servo's and sensors easy and neat.
The problem is to let my Arduino's talk to each other.
For the communication between the Arduino's, I do not like to use the Serial (pin 0 and 1) because it will make debugging through the PC complicated (The UNO shares the same UART between pins 0 and 1 and the USB port).
I first tried to use Softserial however this causes the servo's to hunt all the time because all DO's are interrupted each time SoftSerial sends something.
Now I wonder if the UART pins on the DFR0334 GPIO shield is a separate UART on the shield or that it simply connects to the pins digital 0 and 1 on the Arduino.
If it is separate, how can I use it in my Sketch? I cannot find any reference to this UART in the DFR0334 documentation.
So my question is: How can I use the UART on the DFR0334 ?
Many thanks
Jan
The magnets in the road surface (to start and stop a bus) are on the arm of a servo. This allows me to control the buses movement by controlling these servo's. I also use servo's to operate turn-outs to let the buses change course.
The buses are controlled using a sort of block system whereby a bus can only move on when the next block is vacant.
So I now have 2 Arduino's (because of distance and number of I/O needed) that need to share block occupancy data. I used the DFR0334 GPIO shield because it makes the connection of the servo's and sensors easy and neat.
The problem is to let my Arduino's talk to each other.
For the communication between the Arduino's, I do not like to use the Serial (pin 0 and 1) because it will make debugging through the PC complicated (The UNO shares the same UART between pins 0 and 1 and the USB port).
I first tried to use Softserial however this causes the servo's to hunt all the time because all DO's are interrupted each time SoftSerial sends something.
Now I wonder if the UART pins on the DFR0334 GPIO shield is a separate UART on the shield or that it simply connects to the pins digital 0 and 1 on the Arduino.
If it is separate, how can I use it in my Sketch? I cannot find any reference to this UART in the DFR0334 documentation.
So my question is: How can I use the UART on the DFR0334 ?
Many thanks
Jan
2018-12-21 11:56:21 Hi
The UART pins is the same as the TX/RX pin on P0 and P1, if you don't want to use hardware serial, you still can not use UART pins. Have you consider to use other boards that have more serials like Leonardo or Mega?
robert.chen
The UART pins is the same as the TX/RX pin on P0 and P1, if you don't want to use hardware serial, you still can not use UART pins. Have you consider to use other boards that have more serials like Leonardo or Mega?
![userHeadPic](https://dfimg.dfrobot.com/dfPortrait2.png)