-
-
@possmann I am using 1v69
-
Just got my WIZnet modules from DigiKey and mostly working.
DHCP is fine.
However getting: ERROR: Socket error -7 while sending
This is normally after doing a few http.get() requests.
I have spaced the get requests 30 seconds apart but still getting them unfortunately.
Running eth.setIP() does seem to help though and get it back working, for at least 1 request.
Sometimes will then work for 2 or 3 requests but normally only 1.
-
-
@gordon yes correct.
Not sure what it returns on its second call but it errors.
How do you dump the contents of the variable to see what it is set to and I can let you know.
If I do console.log("" + wlan) all I get is [object Object] both times.
This code works:
var wlan = require("CC3000").connect(); function getTime() { // if we don't get DHCP or a complete request in 30 seconds, // disconnect var failTimeout = setTimeout(function() { console.log("Timed out, disconnecting..."); wlan.disconnect(); }, 30000); wlan.connect( "AccessPointName", "WPA2key", function (s) { if (s=="dhcp") { require("http").get("http://www.pur3.co.uk/time.php", function(res) { // store the result var result = ""; res.on('data', function(data) { result += data; console.log(data); }); /* When the connection closes, print what we got, and then disconnect from WiFi */ res.on('close', function() { console.log("Got: "+result); // finished, disconnect anyway setTimeout(function() { clearTimeout(failTimeout); console.log("Complete!, disconnecting..."); wlan.disconnect(); },1000); }); }); } }); } // Every 24 hours, get the time again setInterval(getTime, 24*60*60*1000);
This doesnt work:
function getTime() { // if we don't get DHCP or a complete request in 30 seconds, // disconnect var failTimeout = setTimeout(function() { console.log("Timed out, disconnecting..."); wlan.disconnect(); }, 30000); var wlan = require("CC3000").connect(); wlan.connect( "AccessPointName", "WPA2key", function (s) { if (s=="dhcp") { require("http").get("http://www.pur3.co.uk/time.php", function(res) { // store the result var result = ""; res.on('data', function(data) { result += data; console.log(data); }); /* When the connection closes, print what we got, and then disconnect from WiFi */ res.on('close', function() { console.log("Got: "+result); // finished, disconnect anyway setTimeout(function() { clearTimeout(failTimeout); console.log("Complete!, disconnecting..."); wlan.disconnect(); },1000); }); }); } }); } // Every 24 hours, get the time again setInterval(getTime, 24*60*60*1000);
-
-
If I run the following code the setInterval fires straight away and continuously, it should only fire every hour:
function test(){ console.log("Test Function"); } setInterval(test, 60*60*1000);
If you change it to this so that it only runs every 24 hours it works OK:
function test(){ console.log("Test Function"); } setInterval(test, 24*60*60*1000);
Is this a bug?
-
OK, seems you are correct and the documentation wrong.
As you say in the DISCONNECTING example here: http://www.espruino.com/CC3000
var wlan = require("CC3000").connect();
Is only called once.
Many thanks for your help.
-
-
WLAN is just a global variable, nothing special, so that I can run the WLAN.disconnect() in another function.
Trying to have one WiFi connection function to avoid code duplication for all the functions that will need WiFi.
According to the documentation here: http://www.espruino.com/Reference#l_WLAN_disconnect it says:
function WLAN.disconnect()
Completely uninitialise and power down the CC3000. After this you'll have to use require("CC3000").connect() again.I will try it using the sample code where everything is in one function, disconnect and then connect again and see if I get the same issue.
-
-
-
-
Trying to work around the CC3000 when it does not get an address with DHCP.
What I am doing is doing a disconnect after 30 seconds when it fails to get a DHCP address, then wait another 10 seconds and try to connect again.
However I am getting:
WLAN Connecting... Uncaught Error: Function "connect" not found! at line 1 col 274 ...e("CC3000").connect();WLAN.connect(WLAN_SSID,WLAN_WPA2_KEY,f...
Anybody else have a good work around for when it fails to get a DHCP address or any ideas why it is saying the connect function does not exist?
-
-
Using the WebIDE it is corrupting data when saving.
Basically it is adding extra lines or moving text about and putting it in the wrong place, normally only a bit of text.
I have had it duplicate entire functions as well.
e.g. I have just done a save and it has saved it as this:
setTimeout(startWiFi, 3000); setTimeout(startWiFi, 3000); tWiFi, 3000);
There was only one setTimeout(startWiFi, 3000); when I saved it.
I have only edited the files through the WebIDE and it has happened on multiple files.
I only installed the WebIDE in the last couple of days so it should all be the latest versions.
Has anybody else experienced this?
-
-
If it helps here is the code:
SPI1.setup({sck:B3, miso:B4, mosi:B5}); var nrf = require("NRF24L01P").connect( SPI1, C5, C4 ); function onInit() { nrf.init([0,0,0,0,2], [0,0,0,0,1]); } onInit(); dataLine = ""; setInterval(function() { while (nrf.dataReady()) { var data = nrf.getData(); for (var i in data) { var ch = data[i]; if (ch===0 && dataLine!=="") { console.log(dataLine); // we could even save it onto an SD card using require('fs').appendFile("log.txt", dataLine+"\n"); dataLine = ""; } else if (ch!==0) { dataLine += String.fromCharCode(ch); } } } }, 50);
-
Hi,
Following the tutorial here: http://www.espruino.com/Wireless+Temperature+Sensor
However I get:
Uncaught Error: Function "dataReady" not found!
at line 2 col 14
while (nrf.dataReady()) {Looking at the code here: http://www.espruino.com/modules/NRF24L01P.js
I cannot see a dataReady function?
Using an Kickstart Espruino with latest firmware loaded.
The Slave code is working and trying to send.Just the Master code not working
Any ideas?
Thanks
R
OK maybe not.
Just set it back to use the Linux server DNS and it is working fine now.
Not having to call the eth.setIP() after each http.get() call either.
Strange.