[SOLVED] How to start after login?

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
User avatar
Rongar
Posts: 17
Joined: Tue Oct 13, 2015 6:06 pm

[SOLVED] How to start after login?

Post by Rongar » Tue Oct 13, 2015 6:15 pm

Hi,
just received my WiPy and fired it up. Everything is fine: The Heart Bet is blinking, I see the SSID and can login. But I can't do anything:

Code: Select all

Micro Python v1.4.6-21-gff736d6 on 2015-09-27; WiPy with CC3200
Login as: micro
Password: 
Login succeeded!
Type "help()" for more information.

>>> help
<function>
>>> import pyb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: module not found
Isn't this suppose to load the pyb library (btw. import io won't work either...)? Or is there no interactive operation supported? Bare with me, I'm a total python noob :roll:

I haven't tried to upload a file to the little device yet.


Best regards
Rongar

EDIT:
Solution: The pyb is renamed to machine.
Last edited by Rongar on Wed Oct 14, 2015 5:07 am, edited 1 time in total.

BeranekCZ
Posts: 2
Joined: Mon Oct 12, 2015 9:12 pm

Re: How to start after login?

Post by BeranekCZ » Tue Oct 13, 2015 10:11 pm

Hi,
user danicampora wrote this in "Re: Missing pyb, serial console and FTP problem."
Yes, pyb has been renamed to "machine", the new API is here:

https://github.com/micropython/micropyt ... rdware-API

User avatar
platforma
Posts: 258
Joined: Thu May 28, 2015 5:08 pm
Location: Japan

Re: How to start after login?

Post by platforma » Tue Oct 13, 2015 10:20 pm

Just like BeranekCZ said, the pyb module has been renamed. The new changes will be added to the official documentation soon. I suppose the guys are mad busy doing exactly that at the moment. Once thing I noticed in your snippet: the help function (which python told you there) is a function object. In order to call the help function, you need to add the parenthesis to the end of it, help().
If you're completely new to python, try going through a couple of tutorials locally before jumping right into wipy. "Learn Python The Hard Way" might be a good place to start, but there's a ton of tutorials available online.

User avatar
Rongar
Posts: 17
Joined: Tue Oct 13, 2015 6:06 pm

Re: How to start after login?

Post by Rongar » Wed Oct 14, 2015 5:05 am

Thanks for the quick response. And yes that solves the problem.

And I agree they are extremely busy as they also need to take care about the 1300 Kickstarter users. They are just now receiving the boards.

While persistent trying and searching the forum I figured this out too. But I couldn't update my post as it wasn't published (I guess that's a new user thing).

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

Re: How to start after login?

Post by dhylands » Wed Oct 14, 2015 6:12 am

Rongar wrote:While persistent trying and searching the forum I figured this out too. But I couldn't update my post as it wasn't published (I guess that's a new user thing).
Yeah - the first few posts from any given user require moderator approval. We do this to keep the spam out.

mosi
Posts: 28
Joined: Tue Oct 07, 2014 12:07 am

Re: [SOLVED] How to start after login?

Post by mosi » Mon Oct 19, 2015 6:16 pm

Had the same problem,
~$ telnet 192.168.1.1
Trying 192.168.1.1...
Escape character is '^]'.
Micro Python v1.4.6-21-gff736d6 on 2015-09-27; WiPy with CC3200
Login succeeded!
Type "help()" for more information.
>>> help()
Welcome to Micro Python!
For online help please visit http://micropython.org/help/.
For further help on a specific object, type help(obj)

Code: Select all

import machine as pyb 
does the trick.

However, I would expect basic things to work out of the box, like Pyb.free()
or machine.free()

It would help tremendously to put "Getting started" on your main wipy.io page for newcomers, with a trivial basic tutorials on "how to update firmware to latest version" or "how to flash a LED over wifi".

Thanks.

User avatar
Rongar
Posts: 17
Joined: Tue Oct 13, 2015 6:06 pm

Re: [SOLVED] How to start after login?

Post by Rongar » Mon Oct 19, 2015 8:12 pm

Hi mosi,
your problems are very understandable.

Maybe this might be a nice startingpoint. As switching between two WLANs drove me nuts. Adapt the WLAN settings (SSID and Password, optional fixed IP) and put this in the /flash/ folder. Or maybe use a separate file and call it from the boot.py. It mounts the SD-Card (you can remove the lines if you don't have a SD card attached) and automagically logs in into your main WLAN. Works like a charm.

Code: Select all

# boot.py -- run on boot-up
# can run arbitrary Python, but best to keep it minimal

from machine import SD
import os
sd = SD(pins=('GP10', 'GP11', 'GP15'))
os.mount(sd, '/sd')

from network import WLAN
wifi = WLAN(mode=WLAN.STA)
nets = wifi.scan()
for net in nets:
    if net.ssid == 'HERE-IS-YOUR-SSID':
        # timeout after 5s, otherwise try until error
        wifi.connect(net.ssid, auth=(net.auth, 'HERE-IS-YOUR-WLAN-PASSWORD'), timeout=5000)
        # default ifconfig is 'dhcp', if static ip is desired, set it now
        # wlan.ifconfig(config=('192.168.178.107', '255.255.255.0', '192.168.178.1', '8.8.8.8'))
        break

Post Reply