Go Down

Topic: Arduino Yun Mini and javascript (Read 783 times) previous topic - next topic


Hi. I want to ask about Arduino Yun Mini and javascript.

I bought Arduino Yun Mini and success to control with bridge example.(I can see the data (0 or 1) or D12 with http://ip address/arduino/digital/12.)

And, I want to get data from Arduino Yun Mini and I want to use in javascript code. But I have no idea.

For example,

1) tact switch is connected to D12 of Arduino Yun Mini

2) My Javascript code get the data of D12 (0 or 1)

3) Use this data (0 or 1) as a value for doing something in the website(i.e. change color of text as red when it is 0, black when it is 1)

Can I use ip address for communication of between arduino yun mini and website??
or is there any other method to do it??



I uploaded bridge example to Arduino Yun Mini.
And I change a little bit basic code from official code

Code: [Select]

<!DOCTYPE html>
    <script type="text/javascript" src="zepto.js"></script>
      <script type="text/javascript">
        function refresh() {

    <body onload="setInterval(refresh, 2000);">
        <span id="content">0</span>

But there is error like
Code: [Select]

Uncaught TypeError: $(...).load is not a function at refresh


I just guess what is problem.

1) My Arduino Yun Mini use IP from Smartphone Wifi tethering. So, it is impossible to communicate with javascript..

or 2) Should I have to put this html file into SD card? There is no SD card slot in the Arduino Yun Mini

I thought that when I know the IP address and port of Arduino Yun Mini, i can communicate with arduino yun mini everywhere. But it is impossible to access with other desktop even with REST. >:(

Go Up