Blynk example not working

Questions and discussion about The WiPy 1.0 board and CC3200 boards.
Target audience: Users with a WiPy 1.0 or CC3200 board.
Post Reply
mdgart
Posts: 10
Joined: Mon Feb 08, 2016 8:04 pm

Blynk example not working

Post by mdgart » Mon Feb 08, 2016 8:13 pm

Hi Guys, I started yesterday playing around with wypi, that is awesome so far, but I can't get Blynk library and example to work at all.
I'm trying to run 01_simple.py, I setup the project as indicated in the comment, and then I tried to setup WIFI_SSID and WIFI_AUTH with the wipy credentials and my router credentials, but in both cases when I run the script is simply kill the REPL without doing anything.
I tried to run the script using the USB Serial connection REPL, it block the terminal and the REPL and it does nothing.
So my very newbie questions are:

- WIFI_SSID and WIFI_AUTH should be my router credentials or the wipy wifi credential?
- why the REPL die when I run the script?

Thanks a lot for any help that you can give me.

Mauro

User avatar
danicampora
Posts: 342
Joined: Tue Sep 30, 2014 7:20 am
Contact:

Re: Blynk example not working

Post by danicampora » Mon Feb 08, 2016 9:10 pm

Hello Mauro,

The credentials should be the one of your router, in order to connect to it and get access to internet and to the blynk servers.

The Telnet REPL is killed because the WiPy cannot operate in AP and Station mode at the same time, therefore when you set is as Station to connect to your router, the telnet connection is terminated.

I think that the problem here is that connecting to the WiFi network is not succeeding, so better add a ms timeout value to wlan.connect(..., timeout=5000).

In order to debug the issue, try the blynk example line by line from the UART (USB) REPL.

Cheers,
Daniel

mdgart
Posts: 10
Joined: Mon Feb 08, 2016 8:04 pm

Re: Blynk example not working

Post by mdgart » Mon Feb 08, 2016 9:37 pm

Hi Daniel, that's exactly the problem, when I add the timeout I have this error:
OSError: the requested operation failed

So I'm guessing that I can't access the wifi via the wipy for some reason, the credentials are correct.
I'm trying to connect to my company wifi, so maybe there is some sort of protection that doesn't allow the wipy to connect.
I'll try this with my home router tonight, thanks so much for your help!

Mauro

mdgart
Posts: 10
Joined: Mon Feb 08, 2016 8:04 pm

Re: Blynk example not working

Post by mdgart » Tue Feb 09, 2016 10:03 pm

This is resolved, with a different wifi network it works like a charm.
Thanks!

AJWIFI
Posts: 5
Joined: Sun May 29, 2016 5:30 am

Re: Blynk example not working

Post by AJWIFI » Sun May 29, 2016 5:41 am

Hi

*Different Error*

got my shiny new WiPy - great looking board and super easy so far

I have connected it to the home WiFi fine and uploaded all Blynk library files to /flash/lib

trying to run the example too but I get this error

[code]>>> execfile('01_simple.py')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
OSError: could not open file '01_simple.py'[/code]

File permissions?

I see permissions are 664, do these need to be executable 777 I assume?
My ftp process (from macbook command line) drops off the permissions?

[code]ftp> ls
227 (192,168,1,230,7,232)
150
-rw-rw-r-- 1 root root 17374 Jan 1 00:27 BlynkLib.py
-rw-rw-r-- 1 root root 1615 Jan 1 00:26 02_virtual_read.py
-rw-rw-r-- 1 root root 1562 Jan 1 00:26 03_virtual_write.py
-rw-rw-r-- 1 root root 1726 Jan 1 00:26 04_tweet_notify.py
-rw-rw-r-- 1 root root 1293 Jan 1 00:26 06_terminal_repl.py
-rw-rw-r-- 1 root root 1756 Jan 1 00:26 05_terminal.py
-rw-rw-r-- 1 root root 1535 Jan 1 00:26 07_user_task.py
-rw-rw-r-- 1 root root 1752 Jan 1 00:26 08_simple_ssl.py
-rw-rw-r-- 1 root root 914 Jan 1 00:27 ca.pem
-rw-rw-r-- 1 root root 1314 Jan 1 00:26 01_simple.py[/code]

AJWIFI
Posts: 5
Joined: Sun May 29, 2016 5:30 am

Re: Blynk example not working

Post by AJWIFI » Mon May 30, 2016 2:47 pm

I did find it works with the full path
[code]>>> execfile('/flash/lib/01_simple.py')[/code]
perhaps I need to set some env variables (sorry new to python)
still be keen to know how to change file permissions or if they even matter in this context?

[code]os.chmod("/flash/lib/01_simple.py", 0777) [/code]
not supported in micro

User avatar
dhylands
Posts: 3301
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: Blynk example not working

Post by dhylands » Mon May 30, 2016 4:07 pm

The FAT filesystem has no notion of permissions like say ext3 does.

I think that the only attribute that maps is read-only.

User avatar
r4space
Posts: 6
Joined: Wed Jun 03, 2015 4:24 pm

Re: Blynk example not working

Post by r4space » Sun Jun 19, 2016 8:38 pm

Hi all,

Any suggestions on how to make blynk.run() more verbose?

I can step through running the simple example line by line and see my wipy connect to my router, all the steps execut ewith no error but nothing happens on blynk.run()

It prints:
TCP: Connecting to cloud.blynk.cc:8442

Sits there for maybe 60sec and then resets the REPL

In between Blynk on my phone just says "Your wipy is not in network"


Not sure how to debug as blynk.run() seems to just call socket. I've never used Blynk before so could I have something wrong on my phone setup end? I obviously have the AUTH token, have added the suggested widgets, and press the 'run'/'play' button - anything else to do?

User avatar
r4space
Posts: 6
Joined: Wed Jun 03, 2015 4:24 pm

Re: Blynk example not working

Post by r4space » Mon Jun 20, 2016 8:55 pm

So I can get my laptop to connect to Blynk on my phone so it's not my phone setup or my router blocking the wipy...

Any debug ideas?

Much thanks!

User avatar
r4space
Posts: 6
Joined: Wed Jun 03, 2015 4:24 pm

Re: Blynk example not working

Post by r4space » Tue Jun 21, 2016 11:14 pm

So I found a solution that results in a successful TCP connection. Still having trouble with SSL though.

Find the line for the Blink class constructor in BlinkLib.py:

Code: Select all

def __init__(self, token, server='cloud.blynk.cc', port=None, connect=True, wdt=True, ssl=False):
Change it to look like the following:

Code: Select all

def __init__(self, token, server='blynk-cloud.com', port=None, connect=True, wdt=True, ssl=False):
There was a recent announcement from Blynk that stated they were moving to a new server.

Post Reply