Page 1 of 1

AttributeError: 'Switch' object has no attribute 'value'

Posted: Tue Jan 22, 2019 5:07 am
by locoeng
Hi all,

First post here, I keep getting this error any help would be appreciated. I'm following along with the tutorial for the pyb. TIA

PYB: sync filesystems
PYB: soft reboot
MicroPython v1.8.7 on 2017-01-08; PYBLITEv1.0 with STM32F411RE
Type "help()" for more information.
>>> sw = pyb.Switch()
>>> sw.value()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Switch' object has no attribute 'value'
>>> import pyb
>>> sw = pyb.Switch()
>>> sw.value()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Switch' object has no attribute 'value'
>>> from pyb import Switch
>>> sw = pyb.Switch()
>>> sw.value()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Switch' object has no attribute 'value'
>>>

Re: AttributeError: 'Switch' object has no attribute 'value'

Posted: Tue Jan 22, 2019 10:51 pm
by dhylands
You're using an extremely old version of MicroPython.

The .value() attribute was added in 1.9.1 (you're using 1.8.7) and the latest version is 1.9.4

Re: AttributeError: 'Switch' object has no attribute 'value'

Posted: Wed Jan 23, 2019 6:56 am
by locoeng
Thanks!

I have since updated the board and have no issue.