CC3000 WiFi Connect after no DHCP failing #308
Replies: 11 comments
-
Posted at 2014-08-20 by user47955 OK this also occurs after successfully getting a DHCP address, doing what I want with it then doing a disconnect. When I then try to connect the WiFi a minute later it fails with the same error. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-08-20 by DrAzzy It'd be nice if we could figure out which function called connect it's having a hard time with - since there are two there (the require("CC3000").connect() and the WLAN.connect()). |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-08-20 by user47955 It is using this code as per the tutorial, hence the two connect() in the error:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-08-20 by user47955 And the little error arrow is under this connect():
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-08-20 by DrAzzy what does the WLAN object look like? It sounds like the call to require("CC3000").connect(); is returning something bogus the second and subsequent times it's called. Actually, are you even supposed to be using it like that? |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-08-20 by user47955 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:
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. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-08-20 by user47955 OK, not sure how to output the contents of WLAN to see what it is the second time. If I do console.log("" + WLAN); I get [object Object] And get the same the second time when it fails. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-08-20 by user47955 OK, seems you are correct and the documentation wrong. As you say in the DISCONNECTING example here: http://www.espruino.com/CC3000
Is only called once. Many thanks for your help. |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-08-21 by @gfwilliams Just to make sure I understand here, we're saying that if you call Looks like the documentation is incorrect too though - looking at the code it's designed such that you should be able to call either |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-08-21 by user47955 @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:
This doesnt work:
|
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-08-22 by @gfwilliams You can dump it with |
Beta Was this translation helpful? Give feedback.
-
Posted at 2014-08-20 by user47955
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:
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?
Beta Was this translation helpful? Give feedback.
All reactions