Need help programming Blinkt

Hello everyone,

I need some help coming up for a code to make my Blinkt flash in a certain pattern.

I’d like pixels 1-4 to flash blue at the same time, shut off, and then have pixels 5-8 flash red. Kind of like a police light bar.

Any advice would be great. Sorry, I’m new to all of this!

pimoroni/blinkt: Python Library for Blinkt; 8 APA102 LEDs for your Raspberry Pi (
Welcome — Blinkt! 0.1.1 documentation (

Something like this should work. You might have to tweak it a little if I made a typo, etc.

import time
import blinkt

blinkt.set_pixel(0, 0, 0, 255, brightness=None)
blinkt.set_pixel(1, 0, 0, 255, brightness=None)
blinkt.set_pixel(2, 0, 0, 255, brightness=None)
blinkt.set_pixel(3, 0, 0, 255, brightness=None)
blinkt.set_pixel(4, 255, 0, 0, brightness=None)
blinkt.set_pixel(5, 255, 0, 0, brightness=None)
blinkt.set_pixel(6, 255, 0, 0, brightness=None)
blinkt.set_pixel(7, 255, 0, 0, brightness=None)

That is extremely helpful and just what i was looking for. thank you so much!