You are reading a single comment by @Frida and its replies. Click here to read the full conversation.
  • 
    // cc3000_connect
    
    
    
    pinMode(A10,'input_pullup');
    
    setBusyIndicator(LED3);        // GUL
    
    setWatch(function() {
      console.log("----------Interrupt--------­--");
    }, B8, { repeat: true, edge: 'falling', debounce: 50 });
    
    
    id0 = setInterval(function(){
      digitalPulse(LED2,1,70);    // BLÅ
    },500);
    
    var i = 0;
    var alt = false;
    var bool = false;
    var http = require("http");
    
    var wlan = require("CC3000").connect();
    
    
    wlan.connect( "Propeller", "thaeBoLiit", function (s) {
      if (s=="dhcp") {
        console.log("MY IP is " + wlan.getIP().ip);
        bool = true;
    //    test();
      }
    });
    
    
    console.log("Frida is my watchdog");
    //console.log(process.memory());
    
    function test() {
    
      if(bool){
        bool = false;
        alt = !alt;
        if(alt){
          httpa = "http://www.pur3.co.uk/hello.txt";
        }else{
          httpa = "http://www.pur3.co.uk/time.php";
        }
        http.get(httpa, function(res)
        {
          digitalWrite(LED1,1);            // RØD
          res.on('data', function(data) {
            console.log(i + " > " + data);
          });
          res.on('close', function() {
            data = " ";
            digitalWrite(LED1,0);          // RØD
            bool = true;
            i++;
    
            id1 = setInterval(function(){
              clearInterval(id1);
              test();
            },10); //1000 ms
    
          });
        });
    
      }else{
        console.log(i + " ----missed----");
      }
    //  i++;
      if(i == 1000){
    //    changeInterval(id0, 200);
    //    console.log(process.memory());
      }
    } // test end
    
    /*
    ' why cant this work
    setWatch(function() {
      console.log("Button pressed");
    }, BTN, { repeat: true, edge: 'rising', debounce: 50 });
    */
    // you'll need to use  edge: 'falling' if you connected the button to 0v 'rising'
    
    /*
    dont insert a line after i+
    f.eks. i = i + 5;
    then I got no ready sign
    even a comment // do not insert something here!
    */
    
    

    This is my testscript for the moment.

About

Avatar for Frida @Frida started