Most recent activity
-
Thanks for the quick reply. I used a USB-TTL converter to see what was on the serial interface when using the same USB power supply.
First I powered on the Pico and connected the serial converter while it ran. I could send commands over the serial interface and the Pico would answer but I did not see any errors (as expected as the Wifi is setup on startup). When I powered on the Pico while the serial converter was connected, it worked without any errors.
So I moved all my onInit() code to a function called foo() and called this method with setTimeout(foo, 20000) from onInit(). My plan was to power on the Pico and then after that connect the serial converter so that I could see what was happening when it tries to connect to the Wifi. But this worked also.
So I just leave the setTimeout() call in onInit and so far it works fine....
-
Hi
I'm running a Pico on 1v80 and I was wondering if this problem still exists.I have the following code:
var ssid, password, url, timeout, apiString, ledInterval, wifiReady, http, wifi, testUrl; //network & http stuff ssid = "myssid"; password = "mypassword"; url = "http://www.myserver.com"; wifiReady = false; //timestuff timeout = 60*1000; //setup apiString = ""; function clearLed() { //clear RGB Pixel } function handleData(data) { //dosomething } function getForecast() { if (wifiReady) { http.get(url, function (res) { apiString = ""; res.on('data', function (data) { apiString += data; console.log(data); }); res.on('close', function () { handleData(apiString); }); }); } } function onInit() { http = require('http'); digitalWrite(B9,1); // enable on Pico Shim V2 //init serial for Wifi Serial2.setup(115200, {rx: A3, tx: A2}); //init LED bus SPI2.setup({baud: 3200000, mosi: B15}); SPI2.send4bit([0, 0, 0], 0b0001, 0b0011); wifi = require("ESP8266WiFi_0v25").connect(Serial2, function (err) { if (err) { clearLed(); } console.log("Connecting to WiFi"); wifi.connect(ssid, password, function (err) { if (err) { clearLed(); throw err; } console.log("Connected"); //add a delay just to make sure an IP address was obtained setTimeout(function () { wifi.getIP(function (err, ip) { if (err) { clearLed(); throw err; } //console.log(ip); wifiReady = true; getForecast(); }); }, 2000); }); }); setInterval(getForecast, timeout); }
When I upload the code to the Pico via the IDE and type save() the code works as expected as long as the Pico is connected to the laptop. However, when I use a USB power supply to power the Pico the code does not work (I don't see any requests from the Pico on the server). So I wonder whether I got something wrong with the save() method or whether the problem still exists. Thanks!
-
Thanks @Gordon! That did the trick and now it works like a charm :)
-
I've just updated my ESP8266 to 0.25.0.0(Jun 12 2015 20:26:28) (returned by AT+GMR) so I guess I'm on the current version.
I connected the ESP8266 to my Pico's Serial1 port and use a 10uF Cap between the 3.3V and GND on the ESP. When I ran the test script I got a CIPSTART fail, but after reading http://forum.espruino.com/conversations/265995/ I added a timeout before making the call.
Serial1.setup(115200, { rx: B7, tx : B6 }); var wifi = require("ESP8266WiFi").connect(Serial1, function(err) { if (err) throw err; wifi.at.debug(); wifi.reset(function(err) { if (err) throw err; console.log("Connecting to WiFi"); wifi.connect("myssid","mysecret", function(err) { //if (err) throw err; console.log("Connected"); setTimeout(function (){ wifi.getIP(function(err, ip) { console.log(err); console.log("ip"); console.log(ip); require("http").get("http://www.pur3.co.uk/hello.txt", function(res) { console.log("Response: ",res); res.on('data', function(d) { console.log("--->"+d); }); }); }); },6000); }); }); });
I get the following output:
["\r\nAT+RST\r\n" ] "\r\nERROR\r\n\r\nOK\r" <--- "\r\nERROR\r\n\r\nOK\r" ] "\n" <--- "\n" ] "\r" <--- "\r" ] "\n ets Jan 8 2013,rst cause:1, boot" <--- "\n ets Jan 8 2013,rst cause:1, boot" ] " ets Jan 8 2013,rst cause:1, boot mode:(3,0)\r\n\r\n" <--- " mode:(3,0)\r\n\r\n" ] "load 0x40100000, len 28460, room 16 \r\n" <--- "load 0x40100000, len 28460, room 16 \r\n" ] "t" <--- "t" ] "tail 12\r\nchksum 0xc3\r\nho 0" <--- "ail 12\r\nchksum 0xc3\r\nho 0" ] "ho 0 tail 12 room 4\r\nload 0x3ffe8000, len 3124, room 12 \r\ntail 8\r\nchksum 0xae\r\nlo" <--- " tail 12 room 4\r\nload 0x3ffe8000, len 3124, room 12 \r\ntail 8\r\nchksum 0xae\r\nlo" ] "load 0x3ffe8c40, len 8476, room 0 \r\ntail 12\r\nchksum 0x49\r\ncsum 0x49\r\n" <--- "ad 0x3ffe8c40, len 8476, room 0 \r\ntail 12\r\nchksum 0x49\r\ncsum 0x49\r\n" ] "r" <--- "r" ] "rlsô" <--- "lsô" ] "rlsô\r" <--- "\r" ] "\n\r\n\r\nFirmware builder: esp8266.ru\r\n\r\nready\r\n" <--- "\n\r\n\r\nFirmware builder: esp8266.ru\r\n\r\nready\r\n" ["ATE0\r\n" ] "AT" <--- "AT" ] "ATE0\r\r\n\r\nOK\r\n" <--- "E0\r\r\n\r\nOK\r\n" ["AT+CIPMUX=1\r\n" ] "\r\nOK\r\n" <--- "\r\nOK\r\n" Connecting to WiFi ["AT+CWMODE=1\r\n" ] "\r\nOK\r\n" <--- "\r\nOK\r\n" ["AT+CWJAP=\"myssid\",\"secret\"\r\n" ] "W" <--- "W" ] "WIFI CONNECTED\r\n" <--- "IFI CONNECTED\r\n" Connected ] "W" <--- "W" ] "WIFI GOT IP\r\n" <--- "IFI GOT IP\r\n" ] "\r" <--- "\r" ] "\nOK\r\n" <--- "\nOK\r\n" ["AT+CIFSR\r\n" ] "+CIFSR:STAIP,\"192.168.192.25\"\r\n+CIFSR:S" <--- "+CIFSR:STAIP,\"192.168.192.25\"\r\n+CIFSR:S" ] "+CIFSR:STAMAC,\"18:fe:34:a2:68:97\"\r\n\r\nOK\r\n" <--- "TAMAC,\"18:fe:34:a2:68:97\"\r\n\r\nOK\r\n" CIFSR failed: +CIFSR:STAMAC,"18:fe:34:a2:68:97" ip undefined ["AT+CIPSTART=0,\"TCP\",\"http://www.pur3.co.uk\",80\r\n" ] "0," <--- "0," ] "0,CONNECT\r\n\r\nOK\r\n" <--- "CONNECT\r\n\r\nOK\r\n" ] "0,CLOSED" <--- "0,CLOSED" ] "0,CLOSED\r\n" <--- "\r\n" >
I can ping the module on IP provided by CIFSR:STAIP but I don't get a response from the GET call.
So I wonder what the error exactly means and how I can fix it. Thanks!
cool, I'm looking forward to that :)