Alljoynjs and The I/O Module

asked 2015-03-31 13:09:24 -0700

AllJoyner gravatar image

I was following this tutorial while playing around with alljoynjs on arduino yun and i am not able to set/get analog pin values. For example when i run light.js example i get the following error:

ALERT: TypeError: I/O function analogIn not supported on pin8 ajs_io.c:189 light_00409520_0002 light strict preventsyield global light.js:24 preventsyield

I have changed the pin 8 to every pin from 0 to 5 (because im using arduino yun) but i get the same error for all of them. Setting and reading digital pins seems to work fine.


edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2015-03-31 15:39:19 -0700

jprestwo gravatar image

updated 2015-03-31 15:52:43 -0700

Have a look at io_info.c https://git.allseenalliance.org/cgit/core/alljoyn-js.git/tree/linux/lininoio/io_info.c

The info array is how you can determine what IO functions each pin supports. The array indexes correspond to pin indexes. So for your example, pins 0 to 5 do not support analog input, just digital. If you want to use analog inputs you need to use pins 14 - 19 (A0 through A5 on the Yun) as seen in the info array.

Others have been confused by this and perhaps it should be communicated on the wiki: The examples in the js folder are not specific to any one device, like the Yun. They were written for others to use as examples and change to fit the device they are using. Some do work out of the box with the Yun but the majority do not. For the ones that do not you will have to change the pin[#] to the pin you wish to use on the Yun.

edit flag offensive delete publish link more


It works now.I knew they were not specific to any device and i tried changing the pins to A0 instead of 0 but havent thought about changing it to 14. Speaking of IO, could you please clarify what Configuration Options and Triggers modes are and when they would be used? Thanks for your help!

AllJoyner ( 2015-04-01 07:40:58 -0700 )edit

Here is the IO documentation: https://git.allseenalliance.org/cgit/core/alljoyn-js.git/plain/doc/html/IO.html This is not really the place to explain what pull up, pull down, rising edge etc. all mean. That is basic embedded terminology and I am sure you can easily find a comprehensive answer (with diagrams) on Google. Glad to hear its working for you!

jprestwo ( 2015-04-01 10:10:26 -0700 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-03-31 13:09:24 -0700

Seen: 181 times

Last updated: Mar 31 '15