• Did the thing mentioned last in previous post: tried with firmware 1v59 and 1v60,... no success... but did not give up yet, flashed back (to present) 1v71 and run it again: guess what: it made it through! My fruit needed obviously some time to really wake up and get whipped into working mood... ;)

    This is the code I'm using:

    var SSID = "MyNetworkId";
    var WPA2Key = "MyWPA2Key";
    
    var log = function(s,e) {
      console.log(((e) ? "E: " : "-: ") + 
        (Math.round((getTime() * 1000)) / 1000) + ": " + 
        s
      );
    };
    
    log("Connecting to CC3000...");
    var wlan = require("CC3000").connect();
    if (wlan) {
      log("Connecting to wifi access point...");
      wlan.connect( SSID, WPA2Key, function (s) {
        log("Connected with " + s);
        if (s == "dhcp") {
          require("http").get("http://www.pur3.co.­uk/hello.txt", function(res) {
            res.on('data', function(data) {
              log(">" + data);
            });
          });
        }
      });
    } else {
      log("Did not get wlan object / not connected to CC3000.",1);
    }
    

    And this is the console output:

     _____                 _
    |   __|___ ___ ___ _ _|_|___ ___
    |   __|_ -| . |  _| | | |   | . |
    |_____|___|  _|_| |___|_|_|_|___|
              |_| http://espruino.com
     1v71 Copyright 2014 G.Williams
    >echo(0);
    -: 264.257: Connecting to CC3000...
    -: 266.877: Connecting to wifi access point...
    =undefined
    -: 273.336: Connected with connect
    -: 283.457: Connected with dhcp
    -: 284.169: >Hello World!
    > 
    

    Interesting is that the callback is obviously called multiple times:

    1. returning connect
    2. returning dhcp

    Now moving on to receive realtime online departure train info... see the cool thread of @russdx at Is Espruino right for my project?

    ...what a rhetorical question for an Espruino fan... ;) --- I have a very good hammer - you got nails?

About

Avatar for allObjects @allObjects started