Can I use UART on Arduino YUN using Alljoyn.js?

asked 2015-03-17 22:04:21 -0700

KETI gravatar image

updated 2015-03-17 22:07:17 -0700

I have developing alljoyn on Arduino YUN using Alljoyn.js. I want to use UART function on YUN, but I don`t know what to do. They introduce page that how can use UART function on YUN like below.
I have conntected RX(0), TX(1) pin to Arduino YUN. But my YUN still not working UART function.
Please help me. Thank you.

IO.uart() IO.uart(,, baud)- Create a new uart peripheral object
1: The pin number of the TX pin on the AllJoyn JS device.
2: The pin number of the RX pin on the AllJony JS device.
baud: The baud rate for the UART peripheral
uart() has 2 functions: write() and read(). The write() function will support many data types: Booleans, numbers, strings, buffers, and arrays of any of the previous types. The read() function takes a length parameter and returns a Duktape Buffer.

var u = IO.uart(IO.pin4, IO.pin5, 115200);
u.write("Hello World");
u.write(["this", "is", "an", "array", "of", "strings"]);
/Read 10 bytes/
var r =;

edit retag flag offensive close merge delete


Can you provide an example of what YOU are doing. The examples in the documentation are generic hence will not always work for everydevice. For peripherals like UART, SPI and I2C there are usually only a select few pins that have that functionality. The Yun for example uses pin[0] for UART TX and pin[1] for UART RX. If you are just trying to plug in the example as is it will not work.

jprestwo ( 2015-03-18 08:55:10 -0700 )edit

Here is my example code for uart on YUN below. I am trying to use uart function. LED work is fine. But, I can`t receive uart data. What`s the problem, jprestwo?

KETI ( 2015-03-18 17:26:09 -0700 )edit

var IO = require('IO'); var u = IO.uart([0],[1], 115200); var led = IO.digitalOut([13]); function sendData() { return function() { led.toggle(); // for test u.write("Hello World"); } } var t = setInterval(sendData(), 1000);

KETI ( 2015-03-18 17:28:50 -0700 )edit

I am sorry. I should have looked at the AJS code for UART. It looks like for the Yun, UART functionality has not yet been implemented. I saw that it did have 2 UART pins defined but the underlying functions are just stubs. Other platforms do have UART but unfortunately the Yun does not at this time.

jprestwo ( 2015-03-19 09:06:55 -0700 )edit

okay, Thank you for your comments!

KETI ( 2015-03-19 17:14:04 -0700 )edit