glowingkitty / NeoPixelPlus

The NeoPixel library plus a testing mode - so you can see how your LEDs would behave directly in the terminal, without any extra hardware.
MIT License
18 stars 3 forks source link

color() takes from 1 to 3 positional arguments but 4 were given #2

Open Farang1969 opened 9 months ago

Farang1969 commented 9 months ago

I have a freshly install RPi Zero, and install pip than did: pip install neopixel_plus

Than tried your example:

from neopixel_plus import NeoPixel NeoPixel(test=True).color(150,200,0)

Only this gives an error:

File "/home/runtime/python/Heartbeat/src/Heartbeat/./test.py", line 4, in NeoPixel(test=True).color(150,200,0) TypeError: color() takes from 1 to 3 positional arguments but 4 were given

Ehhh I only gave 3 arguments???

What goes wrong here? And how can I solve this?

Farang1969 commented 9 months ago

For now I solved it by changing the lines to:

original_r = customization_json['rgb_colors'][0][0] if customization_json and 'rgb_colors' in customization_json else rgb_colors[0][0]

        original_r = customization_json['rgb_colors'][0] if customization_json and 'rgb_colors' in customization_json else rgb_colors[0]
        #original_g = customization_json['rgb_colors'][0][1] if customization_json and 'rgb_colors' in customization_json else rgb_colors[0][1]
        original_g = customization_json['rgb_colors'][1] if customization_json and 'rgb_colors' in customization_json else rgb_colors[1]
        #original_b = customization_json['rgb_colors'][0][2] if customization_json and 'rgb_colors' in customization_json else rgb_colors[0][2]
        original_b = customization_json['rgb_colors'][2] if customization_json and 'rgb_colors' in customization_json else rgb_colors[2]

So by taking out the first [0] reference...

And changing the test code to:

from neopixel_plus import NeoPixel color_list = [50,200,0] NeoPixel(test=True, target='adafruit').color(color_list)

Than it works, but is this right???