I am trying to get the temperature sensor example from the tutorial to work and it seems there is a flaw with the pin attributes:
[code]
>>> import time, machine, onewire
>>> dat = machine.Pin(12)
>>> ds = onewire.DS18B20(onewire.OneWire(dat))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "onewire", line 16, in __init__
AttributeError: 'Pin' object has no attribute 'PULL_NONE'
>>> import port_diag
Flash ID: 1640e0 (Vendor: e0 Device: 4016)
Flash bootloader data:
Byte @2: 00
Byte @3: 40 (Flash size: 4MB Flash freq: 40MHZ)
[/code]
P.S.: I also seem to be unable to activate BBCode here in this forum.
onewire DS18B20 issue
-
- Posts: 7
- Joined: Wed May 04, 2016 2:18 pm
Re: onewire DS18B20 issue
My board is a Witty Cloud board containing an ESP-12. I am having the exact same issue with the same output.
Re: onewire DS18B20 issue
I can confirm this also happens on my module:
Creating the Pin with PULL_UP produces the same result:
GPIO_PULL_NONE is indeed not in the pin dict table in modpybin.c:344
Which is called by onewire.py:63 in the constructor self.cache and in depower function in onewire.py:230.
Code: Select all
>>> import port_diag
Flash ID: 1640c8 (Vendor: c8 Device: 4016)
Flash bootloader data:
Byte @2: 00
Byte @3: 40 (Flash size: 4MB Flash freq: 40MHZ)
Code: Select all
>>> dat = machine.Pin(12, machine.Pin.IN, machine.Pin.PULL_UP)
>>> ds = onewire.DS18B20(onewire.OneWire(dat))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "onewire", line 16, in __init__
AttributeError: 'Pin' object has no attribute 'PULL_NONE'
Which is called by onewire.py:63 in the constructor self.cache and in depower function in onewire.py:230.
-
- Posts: 7
- Joined: Wed May 04, 2016 2:18 pm
Re: onewire DS18B20 issue
I built the firmware from source code (latest commit 65402ab1ec05fd552ceae63e2dcac69095ab1338) and now the error is gone. It appears to have been fixed in commit https://github.com/micropython/micropyt ... 48126ea4a0.
I am not allowed to attach .bin files, otherwise I would have posted the firmware file I built. Obviously it is better to build your own, but I can image people not wanting to spend time on that instead of on actually programming in micropython, which is more fun
I am not allowed to attach .bin files, otherwise I would have posted the firmware file I built. Obviously it is better to build your own, but I can image people not wanting to spend time on that instead of on actually programming in micropython, which is more fun