Search found 337 matches

by devnull
Wed Apr 17, 2019 10:10 am
Forum: General Discussion and Questions
Topic: Extend System Module By Subclassing
Replies: 8
Views: 191

Re: Extend System Module By Subclassing

That's very neat, but this does not appear to work:

Code: Select all

from network import WLAN, STA_IF
original = WLAN(STA_IF)
custom = wlan(original)

custom.xscan()
custom.scan()
I have to call:

Code: Select all

custom._station.scan()
by devnull
Tue Apr 16, 2019 11:34 pm
Forum: General Discussion and Questions
Topic: Extend System Module By Subclassing
Replies: 8
Views: 191

Re: Extend a Module By Subclassing

Hmm. interesting was not aware of the composition approach, but I guess that custom() will not contain all of the original methods and variables from WLAN() in your example, and that I would need to redefine / link them all if required ? i.e. class wlan: def __init__(self, station): self._station = ...
by devnull
Sun Apr 14, 2019 11:45 pm
Forum: General Discussion and Questions
Topic: Extend System Module By Subclassing
Replies: 8
Views: 191

Extend System Module By Subclassing

I realise that this is more of a generic python question rather than micropython specific, but how do I subclass and then add new methods ? Is it possible to add new methods as well as replace existing ones: from network import WLAN class wlan(WLAN): def __init__(self): super().__init__() def scan(s...
by devnull
Mon Apr 08, 2019 6:57 am
Forum: Pyboard D-series
Topic: Home Made Breakout Board
Replies: 1
Views: 253

Home Made Breakout Board

Yellow = X
Black = Y
Red = 3v3OUT
Blue = Ground

Image
by devnull
Mon Apr 08, 2019 3:05 am
Forum: Pyboard D-series
Topic: Pyboard D - Accessories - Availability?
Replies: 5
Views: 189

Re: Pyboard D - Accessories - Availability?

I just checked and the only items out of stock are the WBUS-DIP28 and the EMMC (the one you're intersted in)

Are you viewing a cached page ??
by devnull
Mon Apr 08, 2019 12:44 am
Forum: Pyboard D-series
Topic: Pyboard D - Accessories - Availability?
Replies: 5
Views: 189

Re: Pyboard D - Accessories - Availability?

https://store.micropython.org/

They have been available for a couple of weeks already !
by devnull
Sun Apr 07, 2019 9:29 am
Forum: General Discussion and Questions
Topic: OSX Hidden File Cleanup
Replies: 3
Views: 101

Re: OSX Hidden File Cleanup

Thanks for all the suggestions for improvements, but this is executed from the pyboard device REPL, not on the OSX operating system itself.

I don't think micropython's os has path.join() ??
by devnull
Sun Apr 07, 2019 7:02 am
Forum: MicroPython pyboard
Topic: PyB-to-PyB using I2C?
Replies: 24
Views: 6033

Re: PyB-to-PyB using I2C?

As far as I am aware, the 8266 does not support I2C client mode.
by devnull
Sun Apr 07, 2019 6:29 am
Forum: General Discussion and Questions
Topic: merge variables from one module into another
Replies: 5
Views: 144

Re: merge variables from one module into another

I know that I can do this to import a complete module:

Code: Select all

from network import *
But how can I import a module's class the same way ?

Code: Select all

from network import WLAN as wlan
from wlan import *
by devnull
Sun Apr 07, 2019 2:20 am
Forum: General Discussion and Questions
Topic: OSX Hidden File Cleanup
Replies: 3
Views: 101

OSX Hidden File Cleanup

Thought I would share this which is only really applicable where the device is mounted in the OSX filesystem (i.e. pyboards) osxcln.py import os def deltree(target): print("deltree", target) try: for d in os.listdir(target): try: deltree(target + '/' + d) except OSError: os.remove(target + '/' + d) ...