This example demonstrates how 2 UART interfaces can communicate in a bi-directionnal way.
You need at least 2 UART interfaces on your board to test it :
- UART0: connected to a PC USB port (serial debug interface).
- UART1: can be connected to any type of serial device (Bluetooth, Serial to USB, etc).
Both UARTs are initialized using a baudrate of 9600.
3 concepts of RIOT are illustrated here:
This application has been tested with a bluetooth 42N based board from Sparkfun. It also works with a HC-05 bluetooth module but requires the pins to be adapted.
- Arduino Due
- Arduino Mega
- Samr21-xpro : use EXT1 pins. RX pin is PA23 and TX is PA22. (Note that RX of BT module goes to TX pin on the board, and vice versa)
- mbed_lpc1768 : RX pin is n°9 and TX is n°10. (Note that RX of BT module goes to TX pin on the board, and vice versa)
- Ensure you followed the prerequisites first
- Follow the setup displayed above and plug the board to an USB port of your computer
- Build and flash:
$ cd ~/work/i2c_temperature $ make RIOTBASE=~/work/RIOT BOARD=arduino-due flash
- Start a serial terminal application on your PC (assuming the board is
visible on
/dev/ttyACM0
)
$ gtkterm -p /dev/ttyACM0 -s 9600 -b 8 -e
- Now you can communicate to the other serial Bluetooth interface (using
rfcomm
on Linux or - bluetooth terminal application on an Android phone)
- You can also skip the bluetooth setup hell by using an USB to serial board between the PC and the second UART interface.