mcauser / micropython-tm1637

MicroPython driver for TM1637 quad 7-segment LED modules
MIT License
191 stars 83 forks source link

TM1637 init ValueError #4

Closed VipSaran closed 6 years ago

VipSaran commented 6 years ago

Hi,

can you tell me what could be the problem behind this:

>>> import tm1637
>>> from machine import Pin 
>>> tm = tm1637.TM1637(clk=Pin(5), dio=Pin(4)) 
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: invalid argument(s) value

Tested on: MicroPython v1.9.4 on 2018-05-11; WiPy with CC3200

mcauser commented 6 years ago

There is a ValueError on the brightness validation in init(), but it should be defaulting to 7 (max).

Does ValueError work on the wipy port?

If you run this in the REPL, do you set the same invalid args error? raise ValueError("Brightness out of range")

VipSaran commented 6 years ago

REPL:

>>> raise ValueError("Brightness out of range")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Brightness out of range
>>> 
mcauser commented 6 years ago

Maybe try using the GP pin naming convention and dropping the named arguments. Eg. tm = tm1637.TM1637(Pin(‘GP10’), Pin(‘GP9’))

VipSaran commented 6 years ago

tm = tm1637.TM1637(clk=Pin('GP5'), dio=Pin('GP4')) did the trick. Thanks :)