Skip to content

NeoPixel — Tape Initialization (neopixel_init)

What it does: Creates a np object to control the NeoPixel LEDs and stores the number of LEDs in max_neopixel.

neopixel_init

Inputs

  • pin: data line GPIO pin number.
  • number: number of LEDs in the strip/matrix.

Output

  • None (statement block).

When to use it

  • Always at the beginning of the program before blocks neopixel_control, neopixel_5x5 and neopixel_write.
  • When changing the configuration of the used LED strip.

Tips and pitfalls

  • The number of LEDs must correspond to the real connection, otherwise index errors may occur.
  • Initialization itself does not light anything, it just prepares the driver.

Generated Python example

np = neopixel.NeoPixel(Pin(4), int(25))
max_neopixel = int(25)