Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4919

MicroPython • Re: 2 arguments Bur given three

$
0
0
My das gave me a raspberry PI pico kit to program RGB lights and im a noob at python so i dont know how to fix if anyone wants to help i ill put the code below. Also im using thonny ide

Code:

from machine import Pinfrom neopixel import NeoPixelnum_pixels = 10color = (255, 165, 0)strip_pin = Pin(28, Pin.OUT)my_strip = NeoPixel(strip_pin, num_pixels)my_strip.fill(255, 165, 0)>>> %Run -c $EDITOR_CONTENTMPY: soft rebootTraceback (most recent call last):  File "<stdin>", line 10, in <module>TypeError: function takes 2 positional arguments but 4 were givenMicroPython v1.23.0 on 2024-06-02; Raspberry Pi Pico with RP2040

As a way of solving similar problems if they occur in future, have a look at the official MicroPython documentation.

The information about Neopixel is here: https://docs.micropython.org/en/latest/ ... pixel.html

Specifically the details of fill are here: https://docs.micropython.org/en/latest/ ... Pixel.fill


You could try

Code:

my_strip.fill(color)
You will probably also need to use

Code:

my_strip.write()

Statistics: Posted by B.Goode — Sun Jul 14, 2024 6:20 am



Viewing all articles
Browse latest Browse all 4919

Trending Articles