from machine import Pin 
from utime import sleep 
import neopixel 
import random
import time

NUM_LEDS = 16

leds = neopixel. NeoPixel (Pin(15), NUM_LEDS)

while True:
    sec=time.time()
    if sec%2==0:
        for x in range(NUM_LEDS):
            if x%2==0:
                leds[x]=[255,7,7]
                leds.write()
            else:
                leds[x]=[7,7,255]
                leds.write()
    else:
        for x in range(NUM_LEDS):
            if x%2==0:
                leds[x]=[7,7,255]
                leds.write()
            else:
                leds[x]=[255,7,7]
                leds.write()