4 Replies Latest reply on Nov 27, 2015 3:22 PM by CMata_Intel

    promblem Http server on Intel Edison

    AndrikFilatov

      Hi all,

       

      I tried to manage Edison by http. Download jquery-1.11.3.min.js. I made file index.html


      <html><body>

      <title>Rotation</title> 

      <script src="jquery-1.11.3.min.js">

      </script>  <script>  function showVal(val) { $("#val").text('Value='+val); }  function left() { $.getJSON( "/left", function( data ) { showVal(data['value']); } ) ; } 

      </script>  <a onclick="left();"> <img src="rotate_ccw.png"/> </a> </body></html>


      main.js


      var mraa = require('mraa') !;

      var express = require('express'); var http = require('http'); var app = express();  // папка со статическим контентом app.use(express.static(__dirname + '/public'));  // поворот влево app.get('/left', function () { console.log("hi");});

      http.createServer(app).listen(1337);


      then I connect to the edison 1337 port. All is ok, when I try to push the button I have "hi" in the log. But when i push it 5-6 times there is no any reaction. When i reload the page it work again for 5-6 times. Maybe you know why it happens?



      Andrey


        • 1. Re: promblem Http server on Intel Edison
          Intel_Alvarado

          Hi,

           

          What node.js and mraa versions are you using? Make sure you are using the latest. Also what button are you referring to, some button on the Arduino expansion board or do you have an external push button connected to the Edison?

           

          Have you tried to use the ps command each time you push the button? It may provide some insight on why your app crashes after the 5-6 time.

           

          Sergio

          • 2. Re: promblem Http server on Intel Edison
            AndrikFilatov

            Hi Sergio!

             

            Thanks for your reply! The Idea of the project is very simple. Here is one Edison board. On this board I create listener of port 1337.

            When I connect to this board 192.168.2.25:1337 it open one web page. There is one button Left. I push it and my browser sends queries to the Edison and Edison put into console the text "it's working". If I click this button again - still running. If I click 5-6 times this button the Edison will stop to write to console "it's working".  If I reload the page in the browser - the board starts to work again. It looks like browser starts to cache this operation. I don't understand how to solve it


            Andrey

            • 3. Re: promblem Http server on Intel Edison
              Intel_Alvarado

              Are you sure you are using the latest image, what is the output of configure_edison –version? Have you tried to run dmesg on the .js file?

               

              Sergio

              • 4. Re: promblem Http server on Intel Edison
                CMata_Intel

                Hi Andrey,

                 

                Do you have updates on this?

                Is this happening in all the web browsers or is it just with one?

                Are you running something else in your board?

                 

                Regards,

                Charlie